Allow custom count query