Fixed a memory leak (of pre-settled messages).  Made some optimizations.