Replaced fold with reduce