Fixed majority of the Query subclasses + code cleanup.