Implement order replacement and cancellation. Fix a bunch of bugs.