Improved palette-handling.