search enhancements, some refactors