Refactored all working GUI code