Cleaning up key generation