Added hashchange handler to make back button work correctly.