Moved constructor key handling code into message sending/reception code, with a flag to specify whether the key has been exchanged.