Small refactoring and Gui additions