Added a delay in the main loop