            :process process)
     driver))
 
-(defn connect-driver [driver & [opt]]
+(defn connect-driver
+  "Connects to a running Webdriver server.
+
+  Creates a new session on Webdriver HTTP server. Sets the session to
+  the driver. Returns the modified driver.
+"
+  [driver & [opt]]
   (wait-running driver)
   (let [session (create-session driver)]
     (swap! driver assoc :session session)
     driver))
 
-(defn disconnect-driver [driver]
+(defn disconnect-driver
+  "Disconnects from a running Webdriver server.
+
+  Closes the current session that is stored in the driver. Removes the
+  session from the driver instance. Returns modified driver.
+"
+  [driver]
   (delete-session driver)
   (swap! driver dissoc :session)
   driver)

    (finally
      (stop-driver driver))))

(defmacro with-driver [type opt bind & body]
  `(client/with-pool {}
     (let [~bind (boot-driver ~type ~opt)]
       (try

         (finally
           (quit ~bind))))))

(defmacro with-firefox
  "Performs the body with Firefox session. A shortcut for
  `with-driver`."
  [opt bind & body]
  `(with-driver :firefox ~opt ~bind
     ~@body))

(defmacro with-chrome
  "Performs the body with Chrome session. A shortcut for
  `with-driver`."
  [opt bind & body]
  `(with-driver :chrome ~opt ~bind
     ~@body))

(defmacro with-phantom
  "Performs the body with Phantom.js session. A shortcut for
  `with-driver`."
  [opt bind & body]
  `(with-driver :phantom ~opt ~bind
     ~@body))

(defmacro with-safari
  "Performs the body with Safari session. A shortcut for
  `with-driver`."
  [opt bind & body]
  `(with-driver :safari ~opt ~bind
     ~@body))
