Faster implementation of wrapMessage.