refactor to handle multi-test runs better