add key function.