             // Set wayName
             let name = step.names?.first
             let ref = step.codes?.first
+            
             if let name = name, let ref = ref, name != ref {
-                wayName = "\(name) (\(ref))"
+                wayName = modifyValueByKey != nil ? "\(modifyValueByKey!(.wayName, name)) (\(modifyValueByKey!(.wayName, ref)))" : "\(name) (\(ref))"
             } else if name == nil, let ref = ref {
-                wayName = ref
-            } else {
-                wayName = name ?? ""
+                wayName = modifyValueByKey != nil ? "\(modifyValueByKey!(.wayName, ref))" : ref
+            } else {
+                wayName = name != nil ? modifyValueByKey != nil ? "\(modifyValueByKey!(.wayName, name!))" : name! : ""
             }
         }
 

    typealias InstructionsByModifier = [String: InstructionsByToken]
    
    override func string(for obj: Any?) -> String? {
        guard let step = obj as? RouteStep else {
            return nil
        }

            guard scanner.scanUpTo("}", into: &token) else {
                continue
            }
            
            if scanner.scanString("}", into: nil) {
                if let tokenType = TokenType(rawValue: token as! String) {
                    var replacement: String
                    switch tokenType {
                    case .wayName: replacement = wayName
                    case .destination: replacement = destination
                    case .exit: replacement = exit
                    case .rotaryName: replacement = rotaryName
                    case .laneInstruction: replacement = laneInstruction ?? ""
                    case .modifier: replacement = modifierConstant
                    case .direction: replacement = directionFromDegree(degree: bearing)
                    case .wayPoint: replacement = nthWaypoint
                    }
                    if tokenType == .wayName {
                        result += replacement // already modified above
                    } else {
                        result += modifyValueByKey?(tokenType, replacement) ?? replacement
                    }
                }
            } else {
                result += token as! String
            }
            
        }

        // remove excess spaces
