:lipstick: More refactoring in lib/store/query.js