   func prepareEventViews() {
     pool.enqueue(views: eventViews)
     eventViews.removeAll()
-    for _ in 0...layoutAttributes.endIndex {
+    for _ in 0...regularLayoutAttributes.endIndex {
       let newView = pool.dequeue()
       newView.delegate = eventViewDelegate
       if newView.superview == nil {

  }

  var eventViews = [EventView]()
  public var layoutAttributes = [EventLayoutAttributes]() {
    didSet {
      recalculateEventLayout()
      prepareEventViews()
      setNeedsLayout()
    }
  }
  var pool = ReusePool<EventView>()

  var firstEventYPosition: CGFloat? {
    return layoutAttributes.sorted{$0.frame.origin.y < $1.frame.origin.y}
      .first?.frame.origin.y
  }


  }

  func recalculateEventLayout() {
    
    // only non allDay events need their frames to be set
    let sortedEvents = self.regularLayoutAttributes.sorted { (attr1, attr2) -> Bool in
      let start1 = attr1.descriptor.startDate
      let start2 = attr2.descriptor.startDate
      return start1.isEarlier(than: start2)
