     while i >= 0
       colorLevel = vars.id.nesting[i]
       if validObject(id)
-        o = (unless (colorLevel of id) then fetchValue(vars, id, colorLevel) else id)
+        o = unless (colorLevel of id) then fetchValue(vars, id, colorLevel) else id
         value = fetchValue(vars, o, vars.color.value, colorLevel)
       else
         value = id

# Finds an object's color and returns random if it cannot be found
module.exports = (vars, id, level) ->

  return id.d3plus.color if id.d3plus and id.d3plus.color

  getRandom = (c) ->
    c = fetchValue(vars, c, level) if validObject(c)

  level = vars.id.nesting[level] if typeof level is "number"

  unless vars.color.value
    returnColor = getRandom id
  else

    colors   = []
    i        = vars.id.nesting.indexOf(level)
    getColor = (color) ->
      unless color
        if vars.color.value and typeof vars.color.valueScale is "function"
          return vars.color.valueScale(0)
        getRandom id
      else unless vars.color.valueScale
        if validColor(color) then color else getRandom(color)
