refactor for testing and modularity
- loading of YAML file into separate method
- error initialization takes args