   (println "Go" go-url "-> buildviz" buildviz-url)
 
   (let [sync-start-time (get-start-date (:sync-start-time (:options args)))
-        aggregate-jobs-for-pipelines (set (:aggregate-jobs-for-pipelines (:options args)))
+        sync-jobs-for-pipelines (set (:sync-jobs (:options args)))
         selected-pipeline-group-names (set (drop 1 (:arguments args)))]
 
     (->> (goapi/get-stages go-url)
          (select-stages selected-pipeline-group-names)
-         (emit-start sync-start-time aggregate-jobs-for-pipelines)
+         (emit-start sync-start-time)
          (mapcat #(stage-instances-from sync-start-time %))
          (sort-by :scheduled-time)
          emit-count-items
-         (map add-inputs-for-stage-instances)
-         (map add-job-instances-for-stage-instances)
-         (map #(aggregate-jobs-for-selected-stages % aggregate-jobs-for-pipelines))
+         (map add-inputs-for-stage-instance)
+         (map add-job-instances-for-stage-instance)
+         (map #(aggregate-jobs-for-stage-instance % sync-jobs-for-pipelines))
          (mapcat stage-instances->builds)
          (map put-to-buildviz)
          emit-end)))

   ["-f" "--from DATE" "DATE from which on builds are loaded (by default tries to pick up where the last run finished)"
    :id :sync-start-time
    :parse-fn #(tf/parse date-formatter %)]
   ["-s" "--aggregate PIPELINE" "PIPELINE for which a complete stage will be synced as a job"
    :id :aggregate-jobs-for-pipelines
    :default '()
    :assoc-fn (fn [previous key val] (assoc previous key (conj (get previous key) val)))]
   ["-h" "--help"]])

        (assoc :name job-name)
        (assoc :junit-xml (goapi/get-junit-xml go-url job-instance)))))

(defn- add-job-instances-for-stage-instance [stage-instance]
  (let [job-names (:job-names stage-instance)]
    (assoc stage-instance
           :job-instances (map #(build-for-job stage-instance %) job-names))))
