Adds the count API.

Thought that the count API might be useful instead of searching and extracting the total, but I understand if this is unnecessary.