Updated code and comments according to feedback from the Moodle Code checker