moving the response out to clean up the code