Refactoring and simple gui