some more hacking and reorganizing. changed the spec so that it wraps everything in a document, for pymongo compatibility. but all the tests pass, save for some undefined steps