Factor out GUI code into own class