Fixes #132, using count query with request cache.

Using count query with request cache instead, should be a lot quicker.
Also changed one other method to use the same logic.