Loop chooser

added a function to change the loop value