creating back pre-replay code