adding delay function