     switch action {
     case .TurnOn:
         lights[index] = 1
+        brightness[index] += 1
     case .TurnOff:
         lights[index] = 0
+        
+        //brightness can't be less then 0
+        if (brightness[index]) > 0 {
+            brightness[index] -= 1
+        }
     case .Toggle:
         lights[index] = (lights[index] + 1) % 2
+        brightness[index] += 2
     case .None:
         print("Reached .None case")
     }

        return Instruction.init(start: data.start, end: data.end, input: data.action)
    }
    
    
    performInstructions(instructions)
    let result = countLitLights()
    
    print("there are \(result) lit lights")
    return result
}
    }
}

private func sumElements(source: [Int]) -> Int {
    //"+" is short for "$0 + $1"
    return source.reduce(0, combine: +)
}

public func numberOfLitLights() -> Int {
