add navigation, some refactoring