Added custom delay function.