Refactored to support an external config file