Make the GUI testable and add GUI tests