Refactored and encapsulated GUI class