adding looping functionality (hopefully)