Refactor to support trial runs