utils.reduce implemented and tested