better handling of messages