toConstructor() working & sort fixes

Unfortunately, my work on fixing sort kinda got mixed up in this since it only came up because of the `toConstructor()` method. 

Those changes can be summed up as "now storing sort information in an object instead of an array"

The to constructor stuff works just like it does in mquery.