minor refactoring, navigation logic