Add a replay mode to rebuild database