Query->getCount + refactoring