For some reason, when I used (a modified version of) the Item Balancing algorithm, the bag breaks.
1. selecting an item causes the game to reset
2. scrolling down to the Close option causes the game to freak out (music lags, the palette/colors flip, and eventually it crashes)
Bag colors...