Modified search function