Adding a reduction function