refactor replay to make pipeline more clear