added key exchange in more detail