time delay added , exit button function added