refactored to use protocol_core buffer interface