tidied up tests with helper functions