bit of search logic cleaning