abstract over List in the contents function and extract reduce