Some cleanup of logic in BuildPaletteWidget