updated script to generating response object