Refactor page navigation