The proceeds of the sale of the encumbered property shall be distributed by the decree of the court, as follows:
(1) To pay its just proportion of the general costs of the suit.
(2) To pay the costs of the reference.
(3) To satisfy the several liens in their order of priority, by payment of the sums due, and to become due, according to the decree.
(4) The residue among the owners of the property sold, according to their respective shares.