reorganized to work with the new version of moddl