Added delay function.