I simplified the inputs and made the colours dependant on the steps as well, hoping to see if anything was being scrambled or anything, but save for some pixels being drawn out of order it doesn't seem like the colours are wrong.
I'm stumped.