updated to be compatible with Moodle 2.4