Fix equals.
Fix some queries.
Fix equals.
Refactoring