Some basic code tidy up to conform to Moodle standards