Refactored code into multiple files