Big refactor to chain criteria instead of selectors, and build queries lazily