Changes to key handling