navigation code refactor