      
   # call on transition end
   finishTransition: =>
-    @removeClass @currentPage, 'visible'
     @currentPage.style.display = "none"
-    @addClass @targetPage, 'visible'    
     @currentPage.removeEventListener "webkitTransitionEnd", @finishTransition, false
+    # swap pages
+    @currentPage = @targetPage
     
    resetState: =>
     @back = false
     @isTransitioning = false   
+    
     
    # translate page on secified axis. Duration defaults to speed property when not passed. Delay defaults to 0.
    translate: (page, axis, distance, duration) =>      

    
    if not @currentPage
      # No current panel set, app just started, make start panel visible
      targetPage.style.display = "block"
      @pageHistory = [window.location.hash];
      @startPage = [window.location.hash];
      @currentPage = targetPage
      @addClass @currentPage, 'visible'
      return    
    
    # if already transitioning then return   
    if @isTransitioning is true then return else @isTransitioning = true
    
    # set curent panel
    @currentPage = document.getElementsByClassName('visible')[0]
    if @currentPage is undefined then throw new Error "Current panel not set"    
    
    if @targetPage is @startPage
      @back = true

    @currentPage.style.display = "block"
    @targetPage.style.left = "0%"
    @currentPage.style.left = "100%"
    @isTransitioning = false
  
  # detects user agent being used
  detectUserAgent: ->
