Updated for moodle 2.5