messages.py improved