Re-structured dictionaries to [query-doc, value] instead of [query, [doc, value]] for efficiency.
More efficient relative weight computation in CG.