Modifications based on moodle Tree.java