Updated for moodle 2.7