cleaned up applet package code using Template Method Pattern