Added hashchange hanndler and page hide/show