Refactoring the whole thing. Added the commands module to take care of user input