code cleanup and getting applet working on server