refine the protocol, add comments, add utest for empty packet