     while @link.firstChild
       @link.removeChild(@link.firstChild)
 
-    # then generate new widgets
-    for title, times of @data
-      event = later.parse.text(times)
-      if event.error != -1
-        console.log('error in schedule ' + title + ' at character ' + event.error)
-        continue
-      next = later.schedule(event).next(1)
-      text = @displayFormat.slice(0)
-        .replace(/\$title/g, title)
-        .replace(/\$time/g, @formatTime(next, now))
-        .replace(/\$tminus/g, @formatTminus(next, now))
-
-      # create and display widget element
+    # then create and display new widgets
+    for event in @getEvents(1, @displayFormat, now)
       eventClasses = ['inline-block']
-      if @warnForTime(next, now)
+      if event.isWarning
         eventClasses.push('warn')
         @hasWarning = true
       widget = @createElement('span', eventClasses...)
-      widget.textContent = text
+      widget.textContent = event.displayText
       @link.appendChild(widget)
 
+    # 1 minute refresh during warnings
     if !wasWarning && @hasWarning
-      @startTimer(60000) # 1 minute refresh during warnings
+      @startTimer(60000)
     else if wasWarning && !@hasWarning
       @startTimer()
 

    @tooltip?.dispose()
    @tile?.destroy()
    @tile = null

  # Private: Sets up the event handlers.
  handleEvents: ->

    @timer = null
    @hasWarning = false
    @tooltip = atom.tooltips.add(@link,
      title: => @tooltipTitle()
      html: true
    )

