added menu options and some refactoring