writes working loop function iterating over choices