updated applets code from john