Copied sum over from activesupport