Updated readtag function to return a String value