fixed config file
more refactoring to aid testability