   update: ->
     lastSession = store.get('last_session')
     sessions    = store.get('sessions')
-
-    $(@$sessions).html(
+    template    =
       sessionsTemplate
         lastSession     : lastSession
         lastSessionName : @controller.sessionName(lastSession)
         sessions        : sessions
-    )
+
+    $(@$sessions).html(template)
 
   _createEvents: (events) ->
+    # menu actions
     for key, value of events
       $('body').on 'click', "[data-action='#{key}']", (e) =>
         e.preventDefault()
         e.stopPropagation()
         events["#{e.currentTarget.dataset.action}"]()
 
+    # switching sessions
+    $('body').on 'change', "#{@$tools} input:radio", (e) =>
+      id = $(e.currentTarget).data('session')
+      @controller.setSession(id)
+
+    # hotkeys
     $(document).keydown @_handleKeydown
 
-    @$drag = new Draggabilly(
-      @$peteshow,
-      handle      : @$handle,
-      containment : 'html'
-    )
-
+    # dragging
+    @$drag = new Draggabilly(@$peteshow, handle: @$handle, containment: 'html')
     @$drag
       .on 'dragEnd', @_handleDragEnd
       .on 'staticClick', @open
-
-    $('body').on 'change', '.peteshow-menu input:radio', (e) =>
-      id = $(e.currentTarget).data('session')
-      @controller.setSession(id)
-      return
 
   _handleKeydown: (e) =>
     code = String.fromCharCode(e.keyCode)

_     = require('lodash')
store = require('./storage')

Draggabilly = require('draggabilly')

indexTemplate       = require('../templates/index.hbs')
sessionsTemplate    = require('../templates/sessions.hbs')

class PeteshowView
  controller   : Peteshow.controller

      .change()

  hideSaveSession: =>
    $(@$saveDialog).hide()

  toggleSaveSession: =>
    $(@$saveDialog).toggle()

  show: =>
    $(@$peteshow).show()
