 class $.jQT
   extensions: []
-  animations: []
-  history: []
-  settings: {}
+  animations: [
+    name: "cubeleft"
+    selector: ".cubeleft, .cube"
+    is3d: true
+  ,
+    name: "cuberight"
+    selector: ".cuberight"
+    is3d: true
+  ,
+    name: "dissolve"
+    selector: ".dissolve"
+  ,
+    name: "fade"
+    selector: ".fade"
+  ,
+    name: "flipleft"
+    selector: ".flipleft, .flip"
+    is3d: true
+  ,
+    name: "flipright"
+    selector: ".flipright"
+    is3d: true
+  ,
+    name: "pop"
+    selector: ".pop"
+    is3d: true
+  ,
+    name: "swapleft"
+    selector: ".swapleft, .swap"
+    is3d: true
+  ,
+    name: "swapright"
+    selector: ".swapright"
+    is3d: true
+  ,
+    name: "slidedown"
+    selector: ".slidedown"
+  ,
+    name: "slideright"
+    selector: ".slideright"
+  ,
+    name: "slideup"
+    selector: ".slideup"
+  ,
+    name: "slideleft"
+    selector: ".slideleft, .slide, #jqt > * > ul li a"
+  ]
   orientation: 'portrait'
-
-  addAnimation: ->
-    @::animations.push animation if typeof (animation.selector) is "string" and typeof (animation.name) is "string"
-  addTapHandler: ->
-    tapHandlers.push tapHandler  if typeof (tapHandler.name) is "string" and typeof (tapHandler.isSupported) is "function" and typeof (tapHandler.fn) is "function"
-  getOrientation: ->
-  addTapHandler: (extension) ->
-    @::tapHandlers.push extension
-  goBack: ->
-    # Error checking
-    console.warn "History is empty." if history.length < 1
-    if history.length is 1
-      console.warn "You are on the first panel."
-      window.history.go -1
-    from = history[0]
-    to = history[1]
-    if doNavigation(from.page, to.page, from.animation, true)
-      publicObj
-    else
-      console.warn "Could not go back."
-      false
-
-  insertPages: (nodes, animation) ->    
-    # Call dom.createElement element directly
-    # instead of relying on $(nodes), to work around:
-    # https://github.com/madrobby/zepto/issues/312
-
-    # DK: This is allegedly fixed...
-    # div = document.createElement("div")
-    # div.innerHTML = nodes
-
-    $(nodes).children().each (index, node) ->
-      $node = $(this)
-      $node.attr "id", "page-" + (++newPageCount) unless $node.attr("id")
-      
-      # Remove any existing instances
-      $("#" + $node.attr("id")).remove()
-
-      $body.append $node
-      $body.trigger "pageInserted",
-        page: $node
-
-      targetPage = $node if $node.hasClass("current") or not targetPage
-
-    if targetPage?
-      goTo targetPage, animation
-      targetPage
-    else
-      false
-
-  goTo: (toPage, animation) ->
-    fromPage = history[0].page
-
-    if typeof animation is "string"
-      for i in animations
-        if animations[i].name is animation
-          animation = animations[i]
-          break
-
-    if typeof toPage is "string"
-      nextPage = $(toPage)
-      unless nextPage.length
-        showPageByHref toPage,
-          animation: animation
-
-        return
-      else
-        toPage = nextPage
-    if doNavigation(fromPage, toPage, animation)
-      publicObj
-    else
-      console.warn "Could not animate pages."
-      false
-
-  # PRIVATE DATA
-
-  $body = undefined
-  $head = $("head")
-  history = []
-  newPageCount = 0
-  jQTSettings = {}
-  $currentPage = ""
-  touchSelectors = []
-  publicObj = {}
-  tapBuffer = 100
-  extensions = $.jQT::extensions
-  extTapHandlers = $.jQT::tapHandlers
-  tapHandlers = []
-  animations = []
-  defaults =
+  defaults:
     addGlossToIcon: true
     backSelector: ".back, .cancel, .goback"
     cacheGetRequests: true

    useAnimations: true
    useFastTouch: true
    useTouchScroll: true
    animations: [
      name: "cubeleft"
      selector: ".cubeleft, .cube"
      is3d: true
    ,
      name: "cuberight"
      selector: ".cuberight"
      is3d: true
    ,
      name: "dissolve"
      selector: ".dissolve"
    ,
      name: "fade"
      selector: ".fade"
    ,
      name: "flipleft"
      selector: ".flipleft, .flip"
      is3d: true
    ,
      name: "flipright"
      selector: ".flipright"
      is3d: true
    ,
      name: "pop"
      selector: ".pop"
      is3d: true
    ,
      name: "swapleft"
      selector: ".swapleft, .swap"
      is3d: true
    ,
      name: "swapright"
      selector: ".swapright"
      is3d: true
    ,
      name: "slidedown"
      selector: ".slidedown"
    ,
      name: "slideright"
      selector: ".slideright"
    ,
      name: "slideup"
      selector: ".slideup"
    ,
      name: "slideleft"
      selector: ".slideleft, .slide, #jqt > * > ul li a"
    ]

  # Private functions

  addPageToHistory = (page, animation) ->
    id = page.attr 'id'

    history.unshift
      page: page
      animation: animation
      hash: "#" + id
      id: id

  addDefaultTapHandlers = ->
    addTapHandler
      name: "external-link"
      isSupported: (e, params) -> isExternalLink params.$el

      fn: (e, params) ->
        params.$el.removeClass 'active'
        true

    addTapHandler
      name: "back-selector"
      isSupported: (e, params) ->
        params.$el.is params.jQTSettings.backSelector

      fn: (e, params) ->
        
        # User clicked or tapped a back button
        goBack params.hash

    addTapHandler
      name: "submit-selector"
      isSupported: (e, params) ->
        params.$el.is params.jQTSettings.submitSelector

      fn: (e, params) ->
        
        # User clicked or tapped a submit element
        submitParentForm params.$el

    addTapHandler
      name: "webapp"
      isSupported: (e, params) ->
        params.target is "_webapp"

        # User clicked or tapped an internal link, fullscreen mode
        window.location = params.href
        false
    ,
      name: "no-op"
      isSupported: (e, params) ->
        params.href is "#"

      fn: (e, params) ->
        # Allow tap on item with no href
        params.$el.removeClass 'active'
        true
    ,
      name: "standard"
      isSupported: (e, params) ->
        params.hash and params.hash isnt "#"

      fn: (e, params) =>
        animation = getAnimation(params.$el)
        
        # Internal href
        params.$el.addClass "active"
        @goTo $(params.hash).data("referrer", params.$el), animation, params.$el.hasClass("reverse")
        false
    ,
      name: "external"
      isSupported: (e, params) -> true
      fn: (e, params) ->
        animation = getAnimation(params.$el)
        
