     if now >= end
       return if @restarting
 
-      loops = @model.get('loops')
-
-      if _.isNumber(loops)
+      loops = @model.get 'loops'
+
+      if _.isNumber loops
         @looped ?= 0
         @looped++
 
       if loops == 'infinity' or (_.isNumber(loops) and loops > @looped)
-        @seek(start)
+        @seek start
         @restarting = true
       else
         @pause()
-        @eventhub.trigger('playback:ended')
+        @eventhub.trigger 'playback:ended'
 
     else
       @restarting = false


class VideoLinkShell.RemixView extends LinkShell.RemixView

  className: @classNameExtend('video-link-shell')

  events: => _.extend super,
    'change input.start': => @timeInputChanged 'start'

      slide: (e, ui) =>
        start = ui.values[0]
        end = ui.values[1]
        @changeTimes {start: start, end: end}
      stop: (e, ui) =>
        @eventhub.trigger 'change:shell', @model, @

    @changeTimes
      start: @model.timeStart()
      end: @model.timeEnd()

  setupLoopsButton: =>
    loops = @model.get 'loops'

    if loops == undefined
      loops = 'one'
      @model.set 'loops', loops

    switch loops
      when 'one' then @showLoops 'one'
      when 'infinity' then @showLoops 'infinity'
      else
        # set nLoops value internally and in DOM before showing loop widget
        @nLoops loops
        @$('input.n-loops').val @nLoops()
        @showLoops 'n'

  timeInputChanged: (changed) =>
    start = @$('.start').val()
    end = @$('.end').val()

    data =
      start: acorn.util.Time.timestringToSeconds start
      end: acorn.util.Time.timestringToSeconds end

    # reset invalid input values instead of converting them to 0
    data.start = @model.timeStart() if _.isNaN parseFloat start
    data.end = @model.timeEnd() if _.isNaN parseFloat end

    @changeTimes data, {lock: changed, updateSlider: true}

    @eventhub.trigger 'change:shell', @model, @

  # Args, contained in a single object:
  # @number start - current start time in seconds
