Used the moodle_url class rather than $CFG->wwwroot for links
Removed return statement that prevented the rest of the script from executing