Added ability to supply your own PaletteKey, for custom sorting.