Flatten deeply nested "setTimeout()"