made delay time a parameter an added comments