Refixed the palette persistence bug for the fourth time. Did some misc cleanum.