refactoring navigation click code