Changed fold to a map / reduce