Refactored sending of messages into cleaner api