Refactored message building