Separate the key handling.