Kind of incomplete replay scheduler

The replay scheduler needs some additional testing, etc. but I found a rather obnoxious race condition in the process of working on it, so checking in a fix for race condition.