added create_key function.