Added preliminary "support" for extendable messages. Minor code improvements.