refactored code into smaller modules.