Tidy up some helper functions / tests