Collapse duplicate constants and check for overflow.
Clean out a few TODOs.