Refactor queries logic
  * Use a single lookup
  * Don't try to update immutable state