modified the search codes