Dynamic loops.
Merged in THRILL-jacinto changes