Optimize for large files + lots of refactoring