Appellant’s one assignment of error before this Court is that his pleas of guilty *560were improvident because they were entered pursuant to a pretrial agreement containing an illegal collateral condition viola-tive of Article 63(b), Uniform Code of Military Justice (UCMJ), 10 U.S.C. § 863(b) and paragraph 81d(l), Manual for Courts-Martial, 1969 (Rev.), as well as public policy.
The challenged condition provides for automatic cancellation of the pretrial agreement upon the changing of appellant’s “pleas from guilty to not guilty after trial in any rehearing directed by the convening or higher authority.” This provision was undoubtedly devised to avoid the result encountered in United States v. Lanzer, 3 M.J. 60 (C.M.A.1977), where the Court of Military Appeals held that an accused who pled not guilty at a rehearing ordered by the convening authority was entitled to the sentence limitation benefits of a pretrial agreement because he had complied fully with the agreement’s terms by pleading guilty and entering into a stipulation of fact at the first trial. The agreement in Lanzer was written expressly in terms of pretrial and trial actions by the accused and was silent with respect to a rehearing.
We see nothing in Lanzer which precludes the parties from agreeing that guilty pleas are required at a rehearing as well as the initial trial in order for the accused to qualify for the sentence limitation. Furthermore, contrary to the assertions of appellant, a pretrial agreement provision such as the one encountered here does not abrogate either Article 63(b), UCMJ or paragraph 81d(l) Manual for Courts-Martial, 1969 (Rev.). Accord, United States v. Thomas, 6 M.J. 573 (A.C.M.R.1978), pet. granted, 6 M.J. 91 (C.M.A.1979); United States v. Stoutmire, 5 M.J. 724 (A.C.M.R.1978). If a sentence is reduced by the convening authority in accordance with the terms of a pretrial agreement and higher authority orders a rehearing, the court would be limited at the rehearing to the reduced approved sentence pursuant to paragraph 81d(1), Manual for Courts-Martial, 1969 (Rev.), whether the accused pleads guilty or not guilty. At that point, the issue of whether there is still a viable pretrial agreement becomes irrelevant. The trial judge went over every provision of the pretrial agreement with the appellant in accordance with United States v. Williamson, 4 M.J. 708 (N.C.M.R.1977), and thus assured on the record that appellant understood the meaning and effect of each condition as required by United States v. Green, 1 M.J. 453 (C.M.A.1976). Moreover, pursuant to Williamson, supra, the judge expressly found the provisions of the agreement to be in accord with applicable case law, not contrary to public policy and also fair. We agree with the trial judge’s determination and accordingly reject appellant’s assignment of error.
The findings of guilty and sentence approved below are affirmed.
Judge PRICE and Judge MICHEL concur.