Refactored some code and added and optional argument to specify the config file location