Refactored getModule and hasModule.