added a method to generate response