 relativeURLFromLocation = -> 
   # location.search returns query parameters
 
+
   # fix url encoding of /
   search = location.search?.replace(/\%2[fF]/g, '/')
   loc = location.pathname?.replace(/\%20/g, ' ')
+
   "#{loc}#{search}#{location.hash}"
 
 relativeURLFromStatebus = ->  

    # after it is processed. 
    loc.seek_to_hash = hash

  loc.url = decodeURI(url_parts.pathname)
  loc.hash = hash

  save loc


  relative_url = loc.url 
  if _.keys(loc.query_params).length > 0
    query_params = ("#{k}=#{encodeURIComponent(v)}" for own k,v of loc.query_params)
    relative_url += "?#{query_params.join('&')}" 

  if loc.hash?.length > 0
    relative_url += "##{loc.hash}"
  relative_url
