         }
     }
 
-    private func getCurrentOpeningPeriod(fromOpeningPeriods openingPeriods: [OpenPeriod], forDate date: Date) -> OpenPeriod? {
+    private func getCurrentOpeningPeriod(fromOpeningPeriods openingPeriods: [OpenPeriodDates], forDate date: Date) -> OpenPeriodDates? {
         let currentPeriods = openingPeriods.filter { isTime(date, duringOpeningPeriod: $0) }
         return currentPeriods.first
     }
 
-    private func getNextOpeningPeriod(fromOpeningPeriods openingPeriods: [OpenPeriod], forDate date: Date) -> OpenPeriod? {
-        var nextOpenPeriod: OpenPeriod? = nil
+    private func getNextOpeningPeriod(fromOpeningPeriods openingPeriods: [OpenPeriodDates], forDate date: Date) -> OpenPeriodDates? {
+        var nextOpenPeriod: OpenPeriodDates? = nil
         for openPeriod in openingPeriods {
             if openPeriod.openTime > date {
-                guard let currentOpenTime = nextOpenPeriod else {
+                guard let currentNextOpenPeriod = nextOpenPeriod else {
                     nextOpenPeriod = openPeriod
                     break
                 }
 
-                if openPeriod.openTime < currentOpenTime.openTime {
+                if openPeriod.openTime < currentNextOpenPeriod.openTime {
                     nextOpenPeriod = openPeriod
                 }
             }

        return OpenHours.calendar.date(from: timeDateComponents)
    }

    func nextOpeningTime(forTime time: Date) -> String? {
        guard let allOpeningTimes = getOpeningTimes(forDate: time),
            let openingTime = getNextOpeningPeriod(fromOpeningPeriods: allOpeningTimes, forDate: time) else {

                guard let tomorrowsOpeningPeriods = getOpeningTimes(forDate: time + AppConstants.ONE_DAY),
                    let openingPeriod = getEarliestOpeningPeriod(fromOpeningPeriods: tomorrowsOpeningPeriods) else {
                        return nil
                }
                return timeString(forDate: openingPeriod.openTime)
        }

        return timeString(forDate: openingTime.openTime)
    }

    func closingTime(forTime time: Date) -> String? {

        return OpenHours.calendar.dateComponents(timeComponentsSet, from: dateFromTime)
    }

    private func getOpeningTimes(forDate date: Date) -> [OpenPeriodDates]? {
        guard let openTimesForDay = hours[DayOfWeek.forDate(date)] else {
            NSLog("There are no open time for \(DayOfWeek.forDate(date)) in \(hours)")
            return nil
        }

        let allOpeningTimes: [OpenPeriodDates] = openTimesForDay.flatMap { times in
            guard let openingTime = getDate(forTime: times.openTime, onDate: date),
                var closingTime = getDate(forTime: times.closeTime, onDate: date) else {
                    NSLog("No opening times opening: \(getDate(forTime: times.openTime, onDate: date)), closing: \(getDate(forTime: times.closeTime, onDate: date))")
