Various key file improvements