Bunch of updates to key handling