Tidied up test code a little