 
   closed_medial_strings = (fs) ->
     string_frets = (-1 for s in StringNumbers)
-    string_frets[f.string - 1] = f.fret for f in fs
+    string_frets[pos.string] = pos.fret for pos in fs
     p = ((if x >= 0 then x else 'x') for x in string_frets).join('')
     return p.match(/\dx+\d/)
 
   closed_treble_strings = (fs) ->
     string_frets = (-1 for s in StringNumbers)
-    string_frets[f.string - 1] = f.fret for f in fs
-    p = ((if x >= 0 then x else 'x') for x in string_frets).reverse().join('')
+    string_frets[pos.string] = pos.fret for pos in fs
+    p = ((if x >= 0 then x else 'x') for x in string_frets).join('')
     return p.match(/x$/)
 
   finger_count = (fs) ->

  high_note_count = (fs) -> -fs.length

  is_first_position = (fs) ->
    _(fs).sortBy((f) -> -f.string)[0].degree_index == 0

  cmp = (fn) -> (x...) -> !fn(x...)


      continue if fretted_strings[string_number]
      ctx.font = "#{closed_string_fontsize}pt Helvetica"
      ctx.fillStyle = 'black'
      ctx.fillText "x", h_gutter + string_number * string_spacing - 1, v_gutter + above_fretboard - 2.5

draw_intervals_from = (root_position, semitones, color) ->
  root_note_number = pitch_number_for_position(root_position)
