optimize replay