       1 (assoc base attr (first nested-features))
       (assoc base attr (into [] nested-features)))))
 
-(defn followed-by-change [feature]
-  (let [changed (selective-change-feature feature)]
-    (list feature changed)))
+(defn followed-by [feature change? close?]
+  (let [change (fn [f] (selective-feature (transform-to-change f)))
+        close  (fn [f] (selective-feature (transform-to-close f)))
+        result [feature]
+        result (if change?
+                 (conj result (change feature))
+                 result)
+        result (if close?
+                 (conj result (close feature))
+                 result)]
+    result))
 
 (defn create-attributes [simple-attributes & {:keys [names]}]
   (let [attribute-names (or names (repeatedly simple-attributes #(random-word 5)))

      (assoc :_current_validity (:_validity feature))
      (assoc :_validity (tf/unparse date-time-formatter (local-now)))))

(defn transform-to-nested [feature]
  (apply dissoc feature [:_action :_collection :_id :_validity :_current_validity]))


    attributes))

(defn random-json-features [out-stream dataset collection total & args]
  (let [{:keys [change? close? nested geometry?] :or {change? false close? false nested 0 geometry? true}} args
        validity (tf/unparse date-time-formatter (local-now))
        attributes (create-attributes 3)
        new-features (repeatedly #(random-new-feature collection attributes))
        with-nested (map #(combine-to-nested-feature % "nested" geometry?) (partition (+ 1 nested) new-features))
        with-extra (mapcat #(followed-by % change? close?) with-nested)
        package {:_meta {}
                 :dataset dataset
                 :features (take total with-extra)}]
    (json/generate-stream package out-stream)))

(defn- random-json-feature-stream* [out-stream dataset collection total & args]
