changed search function