Fix exception & make refresh inline when adding keys

When adding a key an exception due to dereferencing a key not in the
bunch is thrown, this has been fixed.

Also make refreshing unnecessary by pulling API details inline.