All premiums and accrued interest received on the sale of bonds shall be placed in the fund to be used for the payment of principal and interest on the bonds, and the remainder of the proceeds of the bonds shall be placed in the treasury to the credit of the proper improvement fund and applied exclusively to the purpose and object recited in the resolution provided for in Section 31391. When the purpose and object has been accomplished any moneys remaining in such improvement fund shall be transferred to the fund to be used for payment of principal and interest on the bonds. When the purpose and object has been accomplished and all principal and interest on the bonds have been paid, any balance of money then remaining shall be transferred to the general fund.