This initial commit is designed to change as little existing code as possible. Once regression tests are in place that can play back previously recorded data, we can move on to more significant changes.