     finally
       @init = false
       @initDone = true
+
   hashbangRouting: () =>
     @pushStateSupport = false
     if !@hashchangeSupport
       throw new Error("No hashchange support!")
-    @transparentRouting()
-  historyApiRouting: () =>
-    @hashchangeSupport = false
     @transparentRouting()
 
   attachClickListener: =>

  postExecutionListeners: []
  exceptionListeners: []
  debug: false
  log: =>
    if @debug && window.console && console && console.log
      if JSON.stringify
        console.log("ki-router: " + JSON.stringify(arguments))
      else
        console.log(arguments)
  add: (urlPattern, fn, metadata) =>
    @routes.push({route: new SinatraRouteParser(urlPattern), fn: fn, urlPattern: urlPattern, metadata: metadata})
  exec: (path) =>
    if matched = @find(path)
      @log("Found route for", path, " Calling function with params ", matched.params)

        throw error
      @previous = matched
      return matched

  find: (path) =>
    for candidate in @routes
      if params = candidate.route.parse(path, @paramVerifier)
        return {params: params, route: candidate.matchedRoute, fn: candidate.fn, urlPattern: candidate.urlPattern, path: path, metadata: candidate.metadata}

  addPostExecutionListener: (fn) =>
    @postExecutionListeners.push(fn)

  addExceptionListener: (fn) =>
    @exceptionListeners.push(fn)

  pushStateSupport: history && history.pushState
  hashchangeSupport: "onhashchange" of window
  hashBaseUrl: false
  disableUrlUpdate: false
  fallbackRoute: false
  init: false
  initDone: false
  clickCount: 0

  historyApiRouting: () =>
    @hashchangeSupport = false
    @transparentRouting()

  transparentRouting: () =>
    @init = true
