Cleaning up the code in the text client a bit