Revert "Performance improvements to searching."

Memory leaks were detected when using the technique.

This reverts commit 5a588a1ae58309923cafc8ce849f1f59c65252a5.