message handling enhancements

using structs for message types to simplify message handling. increases
the code size and maybe needs to be reverted if size is an issue.