Update for Moodle 2.7 and small cleanup