added delay
delay is now in milliseconds