         }
     }
 
-    func compile(step: OSRMStep) -> String? {
-        let modifier = step.maneuverModifier
+    func compile(step: RouteStep) -> String? {
         var type = step.maneuverType
+        let modifier = step.maneuverDirection?.description
+        let mode = step.transportType
 
-        if (type != "depart" && type != "arrive" && modifier == nil) {
+        if (type != .depart && type != .arrive && modifier == nil) {
             return nil
         }
 
-        if (instructions[type] as? NSDictionary == nil) {
+        if (instructions[type?.description as Any] as? NSDictionary == nil) {
             // OSRM specification assumes turn types can be added without
             // major version changes. Unknown types are to be treated as
             // type `turn` by clients
-            type = "turn"
+            type = .turn
         }
 
         var instructionObject: NSDictionary
         let modesInstructions = instructions["modes"] as? NSDictionary
-        let typeInstructions = instructions[type] as! NSDictionary
-        if (step.mode != nil && modesInstructions != nil && modesInstructions![step.mode!] != nil) {
-            instructionObject = modesInstructions![step.mode!] as! NSDictionary
+        let typeInstructions = instructions[type?.description as Any] 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
         } else {

        // Replace tokens
        let nthWaypoint = "" // TODO, add correct waypoint counting
        let destination = (step.destinations ?? "").components(separatedBy: ",")[0]
        let exit = NumberFormatter.localizedString(from: (step.maneuverExit ?? 1) as NSNumber, number: .ordinal)
        let modifierConstant =
            (((instructions["constants"]) as! NSDictionary)
            .object(forKey: "modifier") as! NSDictionary)
            .object(forKey: modifier ?? "straight") as! String
        return instruction.components(separatedBy: " ").map({
                (s: String) -> String in
                    switch s {
                    case "{way_name}": return wayName
                    case "{destination}": return destination
                    case "{exit_number}": return exit
                    case "{rotary_name}": return step.rotaryName ?? ""
                    case "{lane_instruction}": return "" // TODO: implement correct lane instructions
                    case "{modifier}": return modifierConstant
                    case "{direction}": return directionFromDegree(degree: step.maneuverBearingAfter)
                    case "{nth}": return nthWaypoint // TODO: integrate waypoints
                    default: return s
                }

        }

        // Special case handling
        switch type?.description ?? "turn" {
        case "use lane":
            // TODO: Handle
            break
        case "rotary", "roundabout":
            // TODO: Enable once rotary_name exposed in RouteStep
            //            if step.rotaryName != nil && step.maneuverExit != nil, let nameExit = instructionObject["name_exit"] as? NSDictionary {
            //                instructionObject = nameExit
            //            } else if step.rotaryName != nil, let name = instructionObject["name"] as? NSDictionary {
            //                instructionObject = name
            if step.exitIndex != nil, let exit = instructionObject["exit"] as? NSDictionary {
                instructionObject = exit
            } else {
                instructionObject = instructionObject["default"] as! NSDictionary
