add delay to search function