pulled out message creation code for reference