general cleanup + re-introduced replay state checking (why was that one suddenly left out?)