Added handling of response buffer; fixed parsing of incoming packets