Complete most of the coding for adding keys. We can now add a key.