Factor out message generation