Changed colors, refined algorithm to switch pixels