Added setting to change number of loops