Thanks for suggesting `bincount`- it works perfectly here! This function is now ~~bromoved~~ removed.