Refactored code into multiple modules