add non-numeric reduction tests and clean up dataset.reduce code a bit