added header information to all outgoing messages, fixed some performance bugs (double/triple work)