Refactored the code into individual modules.