text parsed refactoring and tests