added proper response handling, to prevent blocking operations