Refactoring, adding new input and GUI code.