a few changes to make running in an applet more feasible