updated 'advanced' example and corrected some bugs