Remove duplicate code

Adding tests for text utils
Merge pull request #1526 from rrosenblum/remove_duplicate_code

Remove duplicate code