Simplified the modules logic