clean up message code