More refactoring, for constructing response objects