added loop for text search