Refactoring large file