refactor protocol to use N lengths before N args