Updated to allow recursive inheritence (inherting from modules that inherit from others).