Refactoring: moved all the config parsing logic to a ConfigParser class