Refactor the code into smaller files