Rebase PR #99 and fix up

Rebase gsalgado's changes from #99, adding tests.

Also, change the semantics of 'Key.rename' to return the new key without mutating the original.
This description doesn't entirely match the code. It seems the API is handling everything. Either that or the effective `delete` never happens.