I removed the pen optimisation which checked to see if the colour was the same before changing, as when I tested with the best case (a screen of solid colour) the total performance improvement was about 20ms. The two for each blocks have a higher individual cost, but when considering they don't recalculate their inputs, and that they change a variable, and reset it at the start of their loops, they are more performant than the repeat until loops. I changed the range of colours to be the full HEX range, and removed the # from the start of the colour codes. This bit may be a bit dodgy, but the pen set colour block no longer does as much work to convert the colours and is faster.