Refactored, and added the ability to get configuration from YAML file