   (m :bpm 140) ; => set bpm to 140"
   [bpm]
   (let [start (atom (now))
-        bpm   (atom bpm)]
-    (Metronome. start bpm)))
+        bar-start (atom @start)
+        bpm   (atom bpm)
+        bpb   (atom 4)]
+    (Metronome. start bar-start bpm bpb)))
 
 ;== Grooves
 ;

      (metro-start [metro] [metro start-beat]
        "Returns the start time of the metronome. Also restarts the metronome at
     'start-beat' if given.")
      (metro-tick [metro]
        "Returns the duration of one metronome 'tick' in milleseconds.")
      (metro-beat [metro] [metro beat]
        "Returns the next beat number or the timestamp (in milliseconds) of the
     given beat.")
      (metro-bpm [metro] [metro new-bpm]
        "Get the current bpm or change the bpm to 'new-bpm'."))))


    (let [new-start (- (now) (* start-beat (metro-tick metro)))]
      (reset! start new-start)
      new-start))
  (metro-bar-start [metro] @bar-start)
  (metro-bar-start [metro start-bar]
    (let [new-bar-start (- (now) (* start-bar (metro-tock metro)))]
      (reset! bar-start new-bar-start)
      new-bar-start))
  (metro-tick  [metro] (beat-ms 1 @bpm))
  (metro-tock  [metro] (beat-ms @bpb @bpm))
  (metro-beat  [metro] (inc (long (/ (- (now) @start) (metro-tick metro)))))
  (metro-beat  [metro b] (+ (* b (metro-tick metro)) @start))
  (metro-bar   [metro] (inc (long (/ (- (now) @bar-start) (metro-tock metro)))))
  (metro-bar   [metro b] (+ (* b (metro-tock metro)) @bar-start))
  (metro-bpm   [metro] @bpm)
  (metro-bpm   [metro new-bpm]
    (let [cur-beat      (metro-beat metro)
          cur-bar       (metro-bar metro)
          new-tick      (beat-ms 1 new-bpm)
          new-tock      (* @bpb new-tick)
          new-start     (- (metro-beat metro cur-beat) (* new-tick cur-beat))
          new-bar-start (- (metro-bar metro cur-bar) (* new-tock cur-bar))]
      (reset! start new-start)
      (reset! bar-start new-bar-start)
      (reset! bpm new-bpm))
    [:bpm new-bpm])
  (metro-bpb   [metro] @bpb)
  (metro-bpb   [metro new-bpb]
    (let [cur-bar       (metro-bar metro)
          new-tock      (beat-ms new-bpb @bpm)
          new-bar-start (- (metro-bar metro cur-bar) (* new-tock cur-bar))]
      (reset! bar-start new-bar-start)
      (reset! bpb new-bpb)))

  clojure.lang.ILookup
  (valAt [this key] (.valAt this key nil))
