added code to reset the GUI state, additional refactorings to improve OO
design.