I've fixed a couple of things that will make the color change a little smoother. Also, I removed duplicate work.

Take a look at the comments below.