added looping, closes #6