Move writing the packet id's into the write method.