Fixes. Note that empty categories give a key error. Need to figure out a way to skip those.