Refactoring data crunching