added key excbange functionality