Added cosine palette generator and cleaned up some stuff