Refactored code into seperate files.