Tidy up test code for clarity