Refactoring slightly to make it more maintainable in deriving the response.