Removed Moodle 1.9 stuff. Further revision required.