completed flagging logic