added validity check.  cleanup messages.