Refactor + start on tests for YAML/JSON config