lots of refactoring and infrastructure for protobuf packets