Returning array for count, with unit tests

Since the cursor returns the wrong count, we return an array. I have
updated the unit test to work with array return type. There is a new
unit test to test the counts.