Refactor key-management

Objects which contexts create are now put in dictionaries on the engines. This is still a work in progress, but it currently has all tests passing. I still need to alter `decorators.py` to use this properly.