Updated Java Applet and cleaned up code