    This function itself should not nothing blocking."
   [time-in-millis response-log-agent log-writer num-threads]
   (send-off response-log-agent (fn [count]
-              (.write log-writer (str "timestamp:" (System/currentTimeMillis) " threads: " num-threads " duration: " time-in-millis "\n"))
-              (if (= 10 count) 
-                (do 
-                  (.flush log-writer); flush writer every 10 log entries
-                  0) ; return 0 as the value to reset count
-                (inc count) ; increment the agent value as a counter
-              )
+              (let [prefix 
+                    (if (= -1 count)
+                      ; first execution (only tabs)
+                      (do (inc count) "\t\t")
+                      ; all other executions (comma, newline and tabs)
+                      ",\n\t\t")]
+                (.write log-writer (str prefix "{\"timestamp\" : " (System/currentTimeMillis) ", \"total_time\" : " time-in-millis ", \"server_time\" : " time-in-millis "}"))
+                (if (= 10 count) 
+                  (do 
+                    (.flush log-writer); flush writer every 10 log entries
+                    0) ; return 0 as the value to reset count
+                  (inc count) ; increment the agent value as a counter
+                  ))
               )))
 
 (defn- send-requests

	          (doseq [f futures]
	            ; wait for each future to complete
	            (deref f))
	          ; (println (deref f 900 #(future-cancel f))) ; this isn't working (returns function but doesn't execute it)
	          (println "Done load test.")))))))
	  

(defmacro duration-in-millis
  "Evaluates expr and records the time it took in millis.

  ([url num-threads]
    (println "Starting load test")
    ; response-log-agent: used for sending response logs to and serializing them to output
    (let [response-log-agent (agent -1)]
	    (with-open [log-writer (io/writer "/tmp/test2.txt")]
	      (println "Log file opened")
        ; hand write some JSON 
        (.write log-writer (str "{"))
        (.write log-writer (str "\n\t\"request\" : \"" url "\","))
        (.write log-writer (str "\n\t\"start_time\" : \"" (get-formatted-date (new java.util.Date)) "\","))
        (.write log-writer (str "\n\t\"num_threads\" : " num-threads ","))
        (.write log-writer (str "\n\t\"requests\" : [\n"))
        ; start the load test and output logs into the JSON
	      (http/with-connection-pool {:timeout 500 :threads 20 :insecure? false :default-per-route 20}
	        (let [futures (doall (for [i (range num-threads)]
	                             (future
