Some tweaks duplicate code into functions.

- Working with text objects.
- Need to start unit testing!