small changes and delay in main loop