Fixed typo in resolveref
Fixed Query bugs, added some tracing code and toString methods
Added external getKeystring function, made results of Queries be the references and not the IDs
Simplified sorting and mapping by restored _qid
Don't worry about result ambiguity with a single database