clean up dataset reduction code and tests