looks like a use-case for underscore's `foldl`