use internal 'counts' implementation

- also submitted as alternative for Rcpp