Improved handling of messages