         return (departureTime: route.departureTime, arrivalTime: route.arrivalTime)
     }
     
-    private func getDelayedDepartureTime(fromRoute route: Route) -> Date? {
-        if let firstDepartDirection = route.getFirstDepartRawDirection(), let delay = firstDepartDirection.delay {
-            return firstDepartDirection.startTime.addingTimeInterval(TimeInterval(delay))
-        }
-        
-        return nil
-    }
-    
-    private func getDepartureTime(fromRoute route: Route) -> Date {
+    private func getDelayState(fromRoute route: Route) -> DelayState {
         if let firstDepartDirection = route.getFirstDepartRawDirection() {
-            return firstDepartDirection.startTime
-        }
-        
-        return route.departureTime
+            
+            let departTime = firstDepartDirection.startTime
+            
+            if let delay = firstDepartDirection.delay {
+                
+                let delayedDepartTime = departTime.addingTimeInterval(TimeInterval(delay))
+                
+                if Time.compare(date1: delayedDepartTime, date2: departTime) != .orderedSame
+                {
+                    return .late(date: delayedDepartTime)
+                }
+                else {
+                    
+                    return .onTime(date: departTime)
+                    
+                }
+                
+            }
+            else {
+                
+                return .noDelay(date: departTime)
+                
+            }
+            
+        }
+        
+        return .noDelay(date: route.departureTime)
+        
     }
 
     // MARK: Set Data

            Network.getDelay(tripId: tripId, stopId: stopId).perform(withSuccess: { (json) in
                if json["success"].boolValue {
                    guard let delay = json["data"]["delay"].int else {
                        self.hideLiveElements()
                        self.setDepartureTimeAndLiveElements(withRoute: route)
                        return
                    }
                    
                    let oneMinute = 60
                    if delay >= oneMinute {
                        let lateTime = direction.startTime.addingTimeInterval(TimeInterval(delay))
                        self.setLiveElementsToLate(withDepartureTime: lateTime)
                        
                        self.setDepartureTime(withStartTime: Date(), withDepartureTime: lateTime, late: true)
                    } else {
                        self.setLiveElementsOnTime()
                        self.setDepartureTimeOnTime()
                    }
                    
                     route.getFirstDepartRawDirection()?.delay = delay
                }
                else {
                    self.hideLiveElements()
                    self.setDepartureTimeAndLiveElements(withRoute: route)                }
            }, failure: { (error) in
                print("RouteTableViewCell setLiveElements(withStartTime:, withDelay:) error: \(error.errorDescription ?? "") Request url: \(error.request?.url?.absoluteString ?? "")")
                self.hideLiveElements()
                self.setDepartureTimeAndLiveElements(withRoute: route)
            })
        }
        else {
            self.hideLiveElements()
            if let route = route {
                self.setDepartureTimeAndLiveElements(withRoute: route)
            }
        }
    }

    private func hideLiveElements() {
        liveIndicatorView.setColor(to: .clear)
        liveLabel.textColor = .clear
    }
    
    private func setLiveElementsOnTime() {
        liveLabel.textColor = .liveGreenColor
        liveLabel.text = "On Time"
        liveIndicatorView.setColor(to:.liveGreenColor)
        
        liveLabel.sizeToFit()
        positionLiveIndicatorView(usingLiveLabel: liveLabel)
    }
    
    private func setDepartureTimeOnTime() {
        departureTimeLabel.textColor = .liveGreenColor
        arrowImageView.tintColor = .primaryTextColor
    }
    
    private func setLiveElementsToLate(withDepartureTime departureTime: Date) {
        liveLabel.textColor = .liveRedColor
        liveLabel.text = "Late - \(Time.timeString(from: departureTime))"
        liveIndicatorView.setColor(to: .liveRedColor)
        
        liveLabel.sizeToFit()
        positionLiveIndicatorView(usingLiveLabel: liveLabel)
    }
    
    private func setDepartureTime(withStartTime startTime: Date, withDepartureTime departureTime: Date, late: Bool) {
        let boardTime = Time.timeString(from: startTime, to: departureTime)
        departureTimeLabel.text = boardTime == "0 min" ? "Board now" : "Board in \(boardTime)"
        departureTimeLabel.textColor = late ? .liveRedColor : .primaryTextColor
        arrowImageView.tintColor = .primaryTextColor
        
        departureTimeLabel.sizeToFit()

    private func setDepartureTimeAndLiveElements(withRoute route: Route) {
        let isWalkingRoute = route.isRawWalkingRoute()

        if isWalkingRoute {
            setDepartureTimeToWalking()
            return
        }
        
        let delayState = getDelayState(fromRoute: route)
        setDepartureTime(withStartTime: Date(), withDelayState: delayState)
        setLiveElements(withDelayState: delayState)
    }
    
    @objc func updateLiveElementsWithDelay() {
