added proper hashchange handling