added in palette logic