Re-arrange the hashchange function