refactored to externalize configuration