sending messages are moved to a new function