(1) Such proceeds shall be brought into Court and applied as follows:- first, in payment of all expenses incident to the sale or properly incurred in any attempted sale; secondly, in payment of whatever is due to the prior mortgagee, on account of the prior mortgage, and of costs, .properly incurred in connection therewith; thirdly, in payme...