bit more refactoring, using activesupport enumerable to replace custom .sum method