Fixed up the GUI. Some refactoring of code.