Refactoring create key.