centralize and clean up message creation logic