Refactored packet registration to make extensions much simpler (and tests to match!).