refactored message sending