Move more code into test/helpers module for reuse