added a configuration validator helper and refactored code and tests