Refactored code to be dynamically configurable