Added menu functionality and some refactors