Clean up, probably fixes a bunch of parameter bugs
Cleaned up query processing
Fixed groupBy clause (was dropping params)