Resolved the index out of range [-1] bug from the word wrap function by checking the cursors' positions before evaluating the preceding character.
Split utility functions into separate files.