Updated for Moodle 2.5