Added palette calculations