We study some of the ways in which the imposition of a partial ordering on a code of laws or regulations can serve to overcome logical imperfections in the code itself. In particular, we first show how partial orderings of a code, and derivative orderings of its power set, may be used to confer uniqueness upon otherwise indefinite derogations by ranking remainders; and second, we show how such orderings may be used to resolve contradictions implicit in a code by a process which we shall call delivery. Finally, we investigate the relations between derogation and delivery, showing that although the two processes appear and are generally assumed to be quite different from each other, nevertheless for finite inconsistent codes, the composite process of derogating and then selecting a remainder turns out to be equipowerful with delivery. For consistent codes, where delivery reduces to its underlying consequence operation and so is of no special interest, the correspondence is with a more general process of ‘relative delivery’. Sections 2 and 3, on derogation and the resolution of contradictions respectively, are written so that they may be read in either order. Section 4, on the relations between the two, depends on both. The study is carried out mathematically, and the reader is assumed to be familiar with elementary properties of partial orderings and consequence operations. Throughout, however, attention is also given to the realities of juridical practice.