Refactored the config generation code so it's smarter and is now contained within the Config class