Refactor the Backend

The backend is a monolithic class with zillions of methods, when it could be a few smaller interface classes, with smart bits kept closer to where they're needed.