     frag.shift() # first edge is garbage like '' or '#!'
 
     path = frag.join '/'
-    
+
     if shouldPushState
-      history[if options.replaceState then 'replaceState' else 'pushState'](
-        {}, KDRouter.getTitle(path), "/#{path}"
-      )
+      method = if options.replaceState then 'replaceState' else 'pushState'
+      history[method] state, @getTitle(path), "/#{path}"
 
     for edge in frag
       if node[edge]

class KDRouter

  listenerKey = 'ಠ_ಠ'

  tree = {}

  currentPath = location.pathname

  getHashFragment =(url)-> url.substr 1 + url.indexOf '#'

  handleNotFound =(route)=> @handleNotFound? route

  changeRoute =(frag, options={})->
    {shouldPushState} = options
    node = tree
    params = {}
    isRooted = '/' is frag[0]


        if param?
          params[param.name] = edge
          node = param
        else @handleNotFound frag.join '/'

    listeners = node[listenerKey]
    if listeners?.length
      listener.call @, params for listener in listeners
