 
 
 cacheCurrentPage = ->
-  pageCache[currentState.position] =
+  pageCache[currentState.url] =
     body:      document.body,
     title:     document.title,
     positionY: window.pageYOffset,
     positionX: window.pageXOffset
 
-  constrainPageCacheTo cacheSize
+  #constrainPageCacheTo cacheSize
 
 pagesCached = (size = cacheSize) ->
   cacheSize = parseInt(size) if /^[\d]+$/.test size


installHistoryChangeHandler = (event) ->
  if event.state?.turbolinks
    if cachedPage = pageCache[event.state.position]
      fetchHistory cachedPage
    else
      visit event.target.location.href

  referer = document.location.href

rememberCurrentUrl = ->
  window.history.replaceState { turbolinks: true, url: document.location.href }, '', document.location.href

rememberCurrentState = ->
  currentState = window.history.state
