various cleanups.
clean up more compiler warnings etc.
fixed message length field handling.
added missing copyright message.
Merge pull request #1 from gardners/development

Code cleaning, lenght fixed and extra char fixed