now correctly passing the category_map var per reference, as
pass-by-value won't do for us here.