Refactor into multiple smaller files