Refactor some OTR code into a Backbone model and adapt tests.