Add function to handle request response