refactor replay to use some parallelism