Clean up key handling