updated to work with Moodle 2.7