Re-wrote reduce method; updated tests