added key handling