updated Delay subrutine.