major performance speedup by pruning cases we've already seen (but tests fail)
fix bug so tests pass; update docs