Add equality method to Query.
Add support for references.
Formatting.