tidy up test to kill off loop
and some more tidying up