Pulling response object outside the inner scope. Refactoring.
Removing unnecessary code.