move packets to protocol, refactor