Start of replay code.