"expected unqualified-id" Error after trying to add delay to parts of script.

Where are the delay()'s you mention? Did you post the right code?