 
 (defn sanitize [pitch scale]
   "For the sake of simplicity, Riffmuse does not support the use of more than
-   one accidental; e.g., double sharps and double flats. For this reason, 
+   one accidental; e.g., double sharps and double flats. For this reason,
    scales like E# major (E# Fx Gx A# B# Cx Dx) are not supported. This function
    is used to ensure that such scales will be spelled enharmonically, e.g.
    E# major -> F major (F G A Bb C D E)."
   (get (condp contains? scale
-         #{:major :major-pentatonic} 
-         {:d-sharp :e-flat, :e-sharp :f, :f-flat :e, 
+         #{:major :major-pentatonic}
+         {:d-sharp :e-flat, :e-sharp :f, :f-flat :e,
           :g-sharp :a-flat, :a-sharp :b-flat, :b-sharp :c}
-          
-         #{:minor :minor-pentatonic :blues} 
-         {:d-flat :c-sharp, :e-sharp :f, :f-flat :e,
+
+         #{:minor :minor-pentatonic :blues}
+         {:c-flat :b, :d-flat :c-sharp, :e-sharp :f, :f-flat :e,
           :g-flat :f-sharp, :a-flat :g-sharp, :b-sharp :c})
        pitch
        pitch))
 
 (defn scale-name [{:keys [pitch scale]}]
   "Converts a scale (a map) to a human-readable string version of its name."
-  (let [pitch (when pitch 
-                (str/replace (name (sanitize pitch scale)) #"-flat|-sharp" 
+  (let [pitch (when pitch
+                (str/replace (name (sanitize pitch scale)) #"-flat|-sharp"
                              {"-flat" "b" "-sharp" "#"}))
         scale (str/replace (name scale) #"-" " ")]
     (-> (str pitch \space scale) str/trim str/capitalize)))
 
 (defmulti notes
-  "Takes the scale (a map) output by parse-cli-args and returns a set of 
+  "Takes the scale (a map) output by parse-cli-args and returns a set of
    notes representing the appropriate scale."
    :scale)
 

        letter->number (zipmap "abcdefg" (range 8))
        number->letter (zipmap (range 8) "ABCDEFG")
        base-number    (->> pitch name first letter->number)
        base-notes     (take 7 (map number->letter 
                                    (iterate #(rem (inc %) 7) base-number)))
        {:keys [sharps flats]} (key-signature pitch major-or-minor)]
    (map (fn [letter] 
           (str letter (when (and sharps (sharps letter)) \#) 
                       (when (and flats (flats letter)) \b)))
         base-notes)))



(defn- circle-of-fifths [major-or-minor]
  (zipmap (case major-or-minor
            :major [:c-flat :g-flat :d-flat :a-flat :e-flat :b-flat :f
                    :c :g :d :a :e :b :f-sharp :c-sharp]
            :minor [:a-flat :e-flat :b-flat :f :c :g :d
                    :a :e :b :f-sharp :c-sharp :g-sharp :d-sharp :a-sharp])
          (range -7 8)))

(defn key-signature [pitch major-or-minor]
