To keep this method clean (and small), perhaps you could move the contents of this if-block to their own method (e.g. loadModuleByName())?