Refactored code into separate modules.