refactored message sending and display