Refactor into separate files