The proceeds of sale for any property sold shall be applied in the following order:
- (a) Payment of the expenses of sale.
- (b) Payment of the other costs of partition in whole or in part or to secure any cost of partition later allowed.
- (c) Payment of any liens on the property in their order of priority except liens which under the terms of sale are to remain on the property.
- (d) Distribution of the residue among the parties in proportion to their shares as determined by the court.