[#48] tidied up the search method