Updated to work with Moodle 2.6