Apply requested changes

* pass range of categories as argument
* output can be sparse