add functions to extract tags and text