Removes all references to the Response object and moves the keys to constants.
Performs some minor miscellaneous refactorings for better consistency.