finalise counting-loop
add some tests for loop-command