
192 Cal.App.2d 564 (1961)
LLOYD HOLIBAUGH, Respondent,
v.
THELMA STOKES et al., Defendants; JAMES R. CLAYTON et al., Appellants.
Civ. No. 19343. 
California Court of Appeals. First Dist., Div. Two.  
May 26, 1961.
 Pelletreau, Gowen, Moses & Porlier and William P. Moses for Appellants.
 Haley, McInerney & Logan and William H. McInerney for Respondent.
 STONE, J. pro tem.  [fn. *]
 Respondent Holibaugh was a fellow employee of one Thelma Stokes. She induced him to provide the money with which to buy three separate parcels of real property in Richmond; one for $2,275; another for $700; and a third for $2,800. Each parcel was purchased in a separate transaction and prior to each purchase, Mrs. Stokes orally agreed to execute a note and deed of trust in favor of respondent to secure the purchase price advanced by him. She neglected to execute the notes and deeds of trust in favor of respondent and he neglected to ascertain whether or not she had done so. Later, Mrs. Stokes needed money and borrowed $700 from appellants and gave them a deed to one parcel of property as security. Concurrently, she entered into an agreement with appellant, Mrs. Claytor, a real estate agent, and appellant, Masterson, Mrs. Claytor's father, a building contractor, to construct a "fourplex" on the property. Mrs. Stokes had the privilege of buying the property back by paying $22,500 in installments in addition to repaying the $700 loan. A few weeks later, Mrs. Stokes again needed money and borrowed $500 from appellants, giving them a deed to the second parcel of property as security and approximately six months later, she borrowed $500 additional from appellants, giving them a deed instead of a mortgage to the third parcel of real property. Only the one parcel was improved by appellants.
 Respondent filed an action naming Mrs. Stokes and appellants *567 as defendants, alleging that Mrs. Stokes held title in trust for him and that the deeds from Stokes to appellants were in fact mortgages. Defendant Stokes defaulted but she appeared at the trial and testified fully concerning all of her transactions with the respondent and with appellants. The testimony of Mrs. Stokes, as well as that of respondent, disclosed that she had agreed to give respondent a note and deed of trust to secure the purchase price of each of the three lots. Respondent, however, in his complaint had alleged that title was to have been taken in his name rather than in that of Mrs. Stokes', and that she had the privilege of obtaining title by reimbursing him the purchase price. At the conclusion of the trial, the court permitted respondent to amend his complaint to conform to the proof and allege title in Stokes and the agreement to execute notes and deeds of trust from Stokes to him. Respondent was permitted to also allege that the deeds from Stokes to appellants were in fact mortgages. Thereafter, the court entered judgment that (1) defendant Stokes was the owner of the three parcels of real property; (2) that the three deeds from Stokes to appellants were in fact mortgages and that appellants have a first lien against each lot for the amount loaned on that parcel, together with interest; (3) that respondent have a lien against each parcel for the purchase price he had advanced to Stokes plus interest and that respondent's liens were each subordinate to appellants' liens on the same parcels; (4) that respondent have judgment for $1,300 against appellants for lumber used in constructing the "fourplex." There is no issue on appeal as to the $1,300 since counsel, during the trial, agreed that appellants were indebted to respondent for that amount.
 Appellants question the sufficiency of the evidence to support the finding that respondent and Stokes agreed to a loan and deed of trust arrangement rather than a transfer of title to respondent and to support the finding that the deeds by which Stokes conveyed to appellants were in fact mortgages. Since there is ample evidence to support both findings, we will not belabor the well-settled point of law that this court is bound thereby (Overton v. Vita-Food Corp., 94 Cal.App.2d 367, 370 [210 P.2d 757]; Berniker v. Berniker, 30 Cal.2d 439, 444 [182 P.2d 557]). [1a] The main thrust of appellants' attack on the judgment is directed against the authority of the court to grant relief to the defaulting defendant Stokes which in turn inured to the respondent. In short, if the deeds executed *568 by the defaulting defendant Stokes are not decreed to be in fact mortgages, then there is no way by which respondent can be afforded any relief as against appellants. His subordinate lien on each parcel of property depends upon the defaulting Stokes' being adjudged the owner of said parcels. Similarly, objection is made to the court's authority to allow respondent to amend his complaint to conform to the proof insofar as the defendant Stokes who defaulted is concerned.
 [2] Counsel for appellants concedes that he has found no cases in point either way, while counsel for respondent relies upon the right of subrogation. Subrogation, however, is a right which arises when one pays a debt for which another is primarily liable. Clearly, we do not have that situation here, as respondent did not pay debts for Mrs. Stokes but advanced money for the purchase of property in her name. [1b] Since the relief granted respondent was purely equitable in nature, the judgment, if it is to be upheld, must be justified under the broad equity powers vested in the trial court. As appellants point out, there are no similar cases but that is not surprising since people don't frequently get real property transactions so fouled up as the participants managed to do in this case. Regardless of the paucity of case law on the subject, Code of Civil Procedure, section 187, appears to be squarely in point. It provides:
 "When jurisdiction is, by the constitution or this code, or by any other statute, conferred on a court or judicial officer, all the means necessary to carry it into effect are also given; and in the exercise of this jurisdiction, if the course of proceeding be not specifically pointed out by this code or the statute, any suitable process or mode of proceeding may be adopted which may appear most conformable to the spirit of this code."
 [3] In Witkin, Summary of California Law, Equity, volume 4, page 2788, we find the following comment: "... equitable relief is flexible and expanding, and the theory that 'for every wrong there is a remedy' (C. C. 3523) may be invoked by equity courts to justify the invention of new methods of relief for new types of wrongs [authorities cited]." [1c] This flexible principle of equity is tailored to fit the situation before us. Although the relief granted the defaulting Stokes was incidental, nonetheless it was absolutely essential to achieve an equitable and just result between respondent and appellants. *569
 [4] Appellants argue that respondent, by failing to follow up his loan to Stokes and compelling her to execute a note and deed of trust, made it possible for appellants to be misled into taking the three deeds from Mrs. Stokes. This argument would be valid were it not for the court's finding, which is supported by the record, that appellants actually made Mrs. Stokes a loan and that the deeds were really intended to be instruments of security. By decreeing the deeds to be what the parties intended, that is documents of security only, and by giving appellants a first lien against the property to secure said loans, appellants got exactly what they originally bargained for. The respondent did nothing to cause a forfeiture of appellants' rights and there is no reason why a court of equity should penalize him. Furthermore, were the court to adopt appellants' argument, it would bestow upon them a windfall in the form of absolute title to the three lots for considerably less than their true value.
 [5a] We think that the trial court's decision is just and reasonable as far as it goes; it simply fails to completely dispose of all of the issues and determine all the rights of the parties. It left unresolved the disposition of appellants' investment of several thousand dollars for construction of the building on one parcel. [6] Respondent argues that the result is a just one as it stands since appellants learned of his claim to an interest in the property during the course of construction but nevertheless completed the work. He argues appellants made the improvements at their own risk. The record, however, indicates that when respondent notified appellants of his interest in the property, he made no attempt to stop the work. In fact, he tacitly agreed that construction should continue and that he would accept a share of the monthly rental from the completed building. His share of the income was to be credited on account of the money he had advanced Mrs. Stokes to buy the lot. Thus, respondent is in no position to contend that appellants proceeded at their own risk and to argue forfeiture. [5b] The inequitable result of leaving appellants' investment in the property unprotected is manifest from the fact that appellants contributed labor and material far in excess of the purchase price provided by respondent. Furthermore, the forfeiture would prove a windfall, not to respondent but to Mrs. Stokes in whom title is vested as to each parcel. Yet, she is the only person involved who invested absolutely nothing in the property and it was *570 she who manipulated the several transactions which created the present situation, to the detriment of all concerned. The court should have awarded appellants a lien, subsequent to respondent's, for the amount of appellants' interest in the building on the property. [7] Since the court had jurisdiction over the parties and the subject matter, it had authority to make a complete disposition of all issues and all facets of the case. It was held in Guardianship of Peterson, 64 Cal.App.2d 473, 478 [149 P.2d 65], that where a court has general jurisdiction of a subject, it has power to make a full disposition of the matter and conclude the litigation respecting it. (See also Code Civ. Proc.,  187.) [5c] A complete determination is necessary not only to settle the interests of the parties but to clarify the title to the real property involved and to prevent subsequent litigation.
 It is ordered that the case be remanded to the trial court to determine appellants' interest in the building; to direct that said amount be payable in accordance with the agreement between appellants and Stokes; that appellants have a lien to secure said payments; that said lien shall be subsequent to the liens of appellants and respondent established by the judgment originally entered in this action by the trial court.
 Draper, Acting P. J., and Shoemaker, J., concurred.
NOTES
[fn. *]  *. Assigned by Chairman of Judicial Council.
