 import Foundation
 import MapboxDirections
 
-class OSRMStep {
-    public let rotaryName: String?
-    public let name: String?
-    public let destinations: String?
-    public let mode: String?
-    public let maneuverModifier: String?
-    public let maneuverType: String
-    public let maneuverExit: Int?
-    public let maneuverBearingAfter: Int?
-    
-    internal init(rotaryName: String?, name: String?, destinations: String?, mode: String?, maneuverModifier: String?, maneuverType: String, maneuverExit: Int?, maneuverBearingAfter: Int?) {
-        self.rotaryName = rotaryName
-        self.name = name
-        self.destinations = destinations
-        self.mode = mode
-        self.maneuverModifier = maneuverModifier
-        self.maneuverType = maneuverType
-        self.maneuverExit = maneuverExit
-        self.maneuverBearingAfter = maneuverBearingAfter
-    }
-
-    internal convenience init(json: [ String: AnyObject ]) {
-        let maneuver = json["maneuver"] as! [ String: AnyObject ]
-
-        self.init(
-            rotaryName: json["rotary_name"] as? String,
-            name: json["name"] as? String,
-            destinations: json["destinations"] as? String,
-            mode: json["mode"] as? String,
-            maneuverModifier: maneuver["modifier"] as? String,
-            maneuverType: maneuver["type"] as! String,
-            maneuverExit: maneuver["exit"] as? Int,
-            maneuverBearingAfter: maneuver["bearing_after"] as? Int
-        )
-    }
-}
-
-// Will automatically read correctly-localized Instructions.plist
+// Will automatically read localized Instructions.plist
 let OSRMTextInstructionsStrings = NSDictionary(contentsOfFile: Bundle.main.path(forResource: "Instructions", ofType: "plist")!)!
 
 class OSRMTextInstructions {

        }

        // Special case handling
        switch type {
        case "use lane":
            // TODO: Handle
            break
        case "rotary", "roundabout":
            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
            } else if step.maneuverExit != nil, let exit = instructionObject["exit"] as? NSDictionary {
                instructionObject = exit
            } else {
                instructionObject = instructionObject["default"] as! NSDictionary

        }
    }

    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) {
            return 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
        }

        var instructionObject: NSDictionary
        let modesInstructions = instructions["modes"] 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 {
