Refactor initial code into modules.