implements count, total, and estimate functions