changes the way to deal with flags and add addi rx