updated code according to moodle standard