P-wrapper: Code cleanup + refactoring

* Renamed some properties and methods to more accurately reflect
  functionality.

* Split up overloaded function into two distinct functions and
  extract common code into one of them.

* Moved buffer resets closer to where they are being processed.

* No change in parser test results (as it should be).

Change-Id: I51a0ae830bf4487e6ff68c869d1457734728fc47