cleaned up code

filled out catch blocks, added javadoc comments, revised design to allow
the gui and communication layer to talk to each other again, and
established closing procedures.