Top-level applet code