If the title of the plaintiffs seeking partition or sale of land for a division shall be controverted, it shall not be necessary for the court to dismiss the complaint, but the question of title shall be tried and determined in the suit and the court shall have power to determine all questions of title, and to remove all clouds upon the title, if any, of the lands whereof partition is sought and to apportion encumbrances, if partition be made of land encumbered and it be deemed proper to do so. The court may adjust the equities between and determine all claims of the several cotenants, as well as the equities and claims of encumbrancers.