Remove duplicate code

Adding tests for text utils