The diff makes it look like I changed much more than I did because indentation changed.  New code is basically just:
- old lines 1-41
- old line 46
- old line 42
- old lines 52-73 (changed indentation)
- old lines 93-end