Adding loop generation.