         // Append extra direction for ending location with ending destination name
         if let direction = rawDirections.last {
             // Set stayOnBusForTransfer to false b/c ending location can never have transfer
-            if direction.type == .walk {
-            rawDirections.append(Direction(type: .walk,
-                                           name: endName,
-                                           startLocation: direction.startLocation,
-                                           endLocation: direction.endLocation,
-                                           startTime: direction.startTime,
-                                           endTime: direction.endTime,
-                                           path: direction.path,
-                                           travelDistance: direction.travelDistance,
-                                           routeNumber: direction.routeNumber,
-                                           stops: direction.stops,
-                                           stayOnBusForTransfer: false,
-                                           tripIdentifiers: direction.tripIdentifiers,
-                                           delay: direction.delay))
-            }
-            else if direction.type == .depart {
-                rawDirections.append(Direction(type: .arrive,
-                                               name: endName,
-                                               startLocation: direction.startLocation,
-                                               endLocation: direction.endLocation,
-                                               startTime: direction.startTime,
-                                               endTime: direction.endTime,
-                                               path: direction.path,
-                                               travelDistance: direction.travelDistance,
-                                               routeNumber: direction.routeNumber,
-                                               stops: direction.stops,
-                                               stayOnBusForTransfer: false,
-                                               tripIdentifiers: direction.tripIdentifiers,
-                                               delay: direction.delay))
+            if direction.type == .walk || direction.type == .depart {
+                let newDirection = Direction(
+                    type: direction.type == .depart ? .arrive : .walk,
+                    name: endName,
+                    startLocation: direction.startLocation,
+                    endLocation: direction.endLocation,
+                    startTime: direction.startTime,
+                    endTime: direction.endTime,
+                    path: direction.path,
+                    travelDistance: direction.travelDistance,
+                    routeNumber: direction.routeNumber,
+                    stops: direction.stops,
+                    stayOnBusForTransfer: false,
+                    tripIdentifiers: direction.tripIdentifiers,
+                    delay: direction.delay
+                )
+                rawDirections.append(newDirection)
             }
         }
         

                    direction.stops.removeLast()
                }
            }

        }
        

                // Change walking direction name to name of location walking from
                if index == first {
                    direction.name = startName
                } else {
                    direction.name = rawDirections[index - 1].stops.last?.name ?? rawDirections[index - 1].name
                }
            }
