Refactored code into different modules