updated delay logic