         var instructionObject: NSDictionary
         let modesInstructions = instructions["modes"] as? NSDictionary
         let typeInstructions = instructions[type?.description ?? ""] as! NSDictionary
-        if mode != nil && modesInstructions != nil && modesInstructions![mode?.description as Any] != nil {
-            instructionObject = modesInstructions![mode?.description as Any] as! NSDictionary
-        } else if modifier != nil && typeInstructions[modifier!] != nil {
-            instructionObject = typeInstructions[modifier!] as! NSDictionary
+        if let mode = mode, let modesInstructions = modesInstructions, let modesInstruction = modesInstructions[mode.description as Any] as? NSDictionary {
+            instructionObject = modesInstruction
+        } else if let modifier = modifier, let typeInstruction = typeInstructions[modifier] as? NSDictionary {
+            instructionObject = typeInstruction
         } else {
             instructionObject = typeInstructions["default"] as! NSDictionary
         }
 
         // Special case handling
         var laneInstruction: String?
+        var rotaryName = ""
+        var wayName = ""
         switch type?.description ?? "turn" {
         case "use lane":
             var laneConfig: String? = ""

            break
        }

        // TODO: Decide way_name with special handling for name and ref
        var wayName = ""
        let name = step.names?.first ?? ""
        let ref = step.codes?.first

        if (!name.isEmpty && ref != nil && name != ref) {
            wayName = name + " (" + ref! + ")";
        } else if (name.isEmpty && ref != nil) {
            wayName = ref!;
        } else {
            wayName = name;
        }

        // Decide which instruction string to use
        // Destination takes precedence over name
        var instruction: String
        if step.destinations != nil && instructionObject["destination"] != nil {
            instruction = instructionObject["destination"] as! String
        } else if wayName != "" && instructionObject["name"] != nil {
            instruction = instructionObject["name"] as! String
        } else {
            instruction = instructionObject["default"] as! String
        }


            break
        case "rotary", "roundabout":
            wayName = step.exitNames?.first ?? ""
            if let _rotaryName = step.names?.first, let _ = step.exitIndex, let obj = instructionObject["name_exit"] as? NSDictionary {
                instructionObject = obj
                rotaryName = _rotaryName
            } else if let _rotaryName = step.names?.first, let obj = instructionObject["name"] as? NSDictionary {
                instructionObject = obj
                rotaryName = _rotaryName
            } else if let _ = step.exitIndex, let obj = instructionObject["exit"] as? NSDictionary {
                instructionObject = obj
            } else {
                instructionObject = instructionObject["default"] as! NSDictionary
            }
