Separated out message code handling