Incorporated recent changes to `text.py` file