Added Palette and code cleanup