Needed: more efficient code, need to learn about functions i think!.....help!

Someone got on this while I was typing, so just to tag on..
The idea, in "millisizing" delay(4000);, is to take note of the time when you initiate an action and then terminate it when the time has gone 4000 past that noted time.