Add support for one time or infinite loop with delay