Refactored messages view and logic