turned parsing functions into a TextParser class