Corrected Infinite Loop When mdelay goes 0