Rewrote changeColor to produce valid solutions