Refactored code into separate files.