Restructuring the hooks to ensure that modules are enabled before cache clear.