Clean $bucket and $key interface

As per #81 we need a better interface to $key and $bucket interfaces. This adds a cleaner interface to these structures and fixes a bug where messages from MR phases may not be processed correctly.