     }
 }
 
-func parseExistingANSI(string:String) -> [ANSIGroup] {
+func parseExistingANSI(string: String) -> [ANSIGroup] {
     var results:[ANSIGroup] = []
     
     let matches = matchesForRegexInText("\\u001B\\[([^m]*)m(.+?)\\u001B\\[0m", text: string, global: true)

    let code = getCode(command)
    let existingANSI = parseExistingANSI(string)
    
    if (code == nil) {
        return string
    } else if (existingANSI.count > 0) {
        return existingANSI.map {
            return ANSIGroup(codes: addCodeToCodesArray($0.codes, code: code!), string: $0.string).toString()
            }.joinWithSeparator("")

    return results
}

func format(string: String, _ command: String) -> String {

    if (NSProcessInfo.processInfo().environment["DEBUG"] != nil && NSProcessInfo.processInfo().environment["DEBUG"]! as String == "true" && (NSProcessInfo.processInfo().environment["TEST"] == nil || NSProcessInfo.processInfo().environment["TEST"]! as String == "false")) {
        return string
