Added printInternalError and some message code handling.