The code is running very slowly, and I think this is because so much of it is within draw. I am guessing I need to create a class, however I don't know where to start as the examples on the Processing site don't contain a variable i (apologies if I am using the wrong terminology!!!)