Added code for the delay functions.