             theSelectedIndexPaths.contains(validForwardIndex.indexPath){
             retval.append(validForwardIndex.indexPath)
         }
-        if let validBackwardIndex = calendarView.layoutAttributesForItemAtIndexPath(NSIndexPath(forItem: indexPath.item - 1, inSection: indexPath.section)) where
+        
+        if let validBackwardIndex = calendarView.collectionViewLayout.layoutAttributesForItemAtIndexPath(NSIndexPath(forItem: indexPath.item - 1, inSection: indexPath.section)) where
             theSelectedIndexPaths.contains(validBackwardIndex.indexPath) {
             retval.append(validBackwardIndex.indexPath)
         }

                    }
                }
            }
            
        }
        return retval
    }

                    }
                    let indexPathOfLastDayOfPreviousMonth = pathsFromDates([lastDayOfPrevMonth])
                    if indexPathOfLastDayOfPreviousMonth.count > 0 {
                        let LastDayIndexPath = indexPathOfLastDayOfPreviousMonth[0]
                        let reCalcRapth = NSIndexPath(forItem: LastDayIndexPath.item + dayIndex, inSection: LastDayIndexPath.section)
                        if let attrib = calendarView.layoutAttributesForItemAtIndexPath(reCalcRapth) {
                            if dateFromPath(attrib.indexPath) == date { retval = attrib.indexPath }
                        }
                    } else {
                        print("out of range error in indexPathOfdateCellCounterPart() upper. This should not happen. Contact developer on github")
