added function for extraction of text