bug fixes and a bit of clean up

* fixed readlines() buffer dropping data. This was due
  to parse() raising a ParseError and breaking out of
  the generator loop

* add few more responses for different types of packets

* replaced _.has_key()_ with _in_