updated version of csparqool to have count function