added navbar, automatic text saving; some refactoring