Major clean up of the module