Rewrite of #291

This optimizes fast path code to not kill existing tests that had timeouts.