minor speedups, incorporated john's reduction changes