Refactor into multiple files