Initial pass over merging 12e184121f18.  This contains the major structural changes.
Second pass for porting 12e184121f18.  Refactored functions that
were refactored during move from laegrader.
Fixing typos.
Final pass for porting 12e184121f18.  Setting a new weight and resetting
weights in cats-and-items works again.