Implement reduce