code refactor && and pagenavbar