Modularise the search method.