Convert functions in texts.py & add tests