revise search function