search abstraction and various fixes

search abstraction and various fixes