
644 P.2d 1060 (1982)
98 N.M. 71
Larry Wayne MOULDER, Plaintiff-Appellant,
v.
Maurice L. BROWN, et al., Defendants-Appellees, and
Joe W. YORK, d/b/a Triple Six Roust-about Service, Defendant-Appellant.
Dan WASHBURN, Plaintiff-Appellant,
v.
Larry BRADFORD, d/b/a Star Welding Service, Defendant-Appellant,
v.
Maurice L. BROWN, et al., Third Party Defendant-Appellees.
No. 5265.
Court of Appeals of New Mexico.
April 20, 1982.
*1061 C. Barry Crutchfield, Templeman & Crutchfield, Lovington, Lowell Stout, Stout & Stout, Hobbs, William G.W. Shoobridge, Neal & Neal, Hobbs, Winston Roberts-Hohl, Singleton & Roberts-Hohl, Santa Fe, for plaintiff-appellant.
Damon C. Richards, Sanders, Bruin & Baldock, William C. Fleming, Cusack, Schnedar & Fleming, Roswell, for defendants-appellees.

OPINION
LOPEZ, Judge.
Summary judgment was granted in favor of Maurice L. Brown against Dan Washburn and his employer Joe W. York, d/b/a Triple Six Roustabout Service, and Larry Wayne Moulder and his employer Larry Bradford, d/b/a Star Welding Service. Washburn and Moulder sued for personal injuries, and their employers sued for contribution and indemnification for workmen's compensation benefits paid to the injured workmen. The parties appeal. We reverse.
The plaintiffs, which hereinafter will be referred to as Moulder, Washburn, York and Bradford, present four issues: 1. the inherently dangerous condition of the work; 2. the duty of Brown based on the issue of control; 3. negligent supervision by Brown; 4. the relationship between the injured workmen and Brown.
The plaintiffs Washburn and Moulder were both injured by an explosion which occurred while they were repairing a heater-treater located on Brown's oil lease. At the time of the explosion, Moulder was welding inside the heater-treater, and Washburn was standing outside assisting Moulder. The heater-treater is a piece of equipment used to separate the emulsion pumped from an oil well into natural gas, oil and water. Washburn was an employee of Triple Six Roustabout Service, hired by Brown to do roustabout services, which included disconnecting all the gas lines and valves leading to the heater-treater for the repair job. Moulder was an employer of Star Welding Company, hired by Brown to weld a leak in the heater-treater.
Washburn and Moulder received workmen's compensation benefits from their respective employers.

Inherently dangerous condition and the duty of Brown to the injured workmen.
The appellants challenge the summary judgment of the trial court on the grounds that there are genuine issues of material fact regarding the inherently dangerous condition of the work and of control of said *1062 work by Brown. The appellees contend that the trial court properly found that the work was inherently dangerous and properly concluded as a matter of law that Brown was immune from liability. The appellees further contend that Brown exercised no control and that the court could so find as a matter of law.
On a motion for summary judgment the trial court must give the party opposing the motion the benefit of all reasonable doubt in determining whether a genuine issue of material fact exists. Goodman v. Brock, 83 N.M. 789, 498 P.2d 676 (Ct.App. 1972). If there is a substantial dispute as to a material fact, the summary judgment is foreclosed. Chevron Oil Company v. Sutton, 85 N.M. 679, 515 P.2d 1283 (1973).
The contentions of the parties regarding the issues of the inherently dangerous condition of the work and of control indicate to us that there is no agreement between the parties as to the facts which would lead to the existence of a duty by Brown to the injured workmen. The general rule is that where the facts are undisputed as to the nature of the work and as to the relationship between the injured employees, the independent contractor and the general contractor or operator, that sometimes the court can decide as a matter of law if a duty exists to employees of an independent contractor. But where the facts are disputed, as in the case at bar, it is not the function of the trial court to weigh the evidence in a summary judgment proceeding. Johnson v. J.S. & H. Construction Co., 81 N.M. 42, 462 P.2d 627 (Ct.App. 1969). Thus we review the pertinent portions of the evidence in the record to determine whether or not the facts are disputed.
Brown, a limited partnership, was the operator of a gas lease where the heater-treater was located. Groesbeck was Brown's consulting engineer and his agent at the site. A leak developed at the bottom of the heater-treater vessel. Groesbeck hired York, d/b/a Triple Roustabout Service, to do the repairs and to arrange with the welder and steamer. York was to perform the Roustabout tasks at the lease site (disconnect the lines going to the heater-treater). Moulder, an employee of Bradford, d/b/a Star Welding Service, was hired to do the welding. Thorne, d/b/a Cotton Lease Service, was hired to steam out the vessel prior to the welding. Groesbeck gave three instructions to York: 1. that all lines to the heater-treater be disconnected; 2. that the welding should be done from the outside, not inside; 3. that the heater-treater should be steamed inside during all the time the welding was being done. The facts are in dispute as to who was in charge at the site. Each employee of every independent contractor had certain duties. York's crew was to disconnect the lines Thorne's crew was to steam the vessel, Moulder was to do the welding.
It became necessary to cut a hole in the skirt around the lower portion of the vessel. York contacted Groesbeck through car radio that they were having difficulty getting the hole large enough for Moulder to do the work from the outside of the heater-treater. Groesbeck gave instructions to make the hole larger but did not come to the site. The steamer and crew had left the location. Not all the lines were disconnected, and Moulder was welding inside when the explosion took place, injuring Moulder and Washburn.
The following quotations from depositions and an affidavit submitted to the court are pertinent to whether the repair was an inherently dangerous activity, and to whether Groesbeck had a duty to Washburn and Moulder. From Mr. Groesbeck's deposition:
Q. When you say you told them to disconnect all the lines, who did you tell?
A. Mr. York.
Q. Did you tell anyone else?
A. No.
Q. Did you give any other specific instructions other than disconnect all lines?
A. Yes.
Q. What were they?
A. Keep the steamer on location until the job was completed.
Q. Why did you tell them that?

*1063 A. Because I wanted the steam going in the vessel all the time they were working on it. I wanted the repair to be done externally, not internally.
Q. Did you tell Mr. York that?
A. Yes. The vessel was skirted. They had to cut a hole in the skirting to allow access to the bottom of the vessel. I think I had one radio communication with Mr. York where they couldn't adequately do the work externally, and I requested that he have the welder cut a larger opening so they could.
Q. So, during the time that the actual repair work was being done while Mr. York was out there and Mr. Washburn and Mr. Moulder, you had communication with Mr. York?
A. I think I had one communication with him.
Q. And that was he related to you the problem 
A. Of getting a large enough opening in the skirt to do the job from underneath.
Q. Did he advise you whether or not they had disconnected all the lines going into the heater treater?
A. No, I didn't; I didn't inquire, because I had requested that all the lines be disconnected. I assumed it had.
* * * * * *
Q. Isn't it true that as far as the real expert in getting this entire job done of repairing the heater treater was yourself, as far as knowledge and prior training?
A. I feel that I probably understand more of the scientific aspects of it, yes.
From the affidavit of Mr. Hill, a welder experienced in all aspects of oil field welding:
It is my opinion based upon the review of such events that the work to be done on the heater treater would have been relatively safe if Mr. Moulder would have worked from the outside. Although any work on a heater treater involves some danger, outside repair greatly lessens any such danger.
However, when the repairs were begun inside the vessel without safety precautions and proper supervision, a very dangerous situation was created. The safety precautions that should have been taken involve testing to determine the presence of gas vapors in the vessel upon each entry and steaming of the entire vessel before entry by Mr. Moulder on the second entry.
It is my opinion that the lack of proper supervision contributed a great extent to the explosion. It has always been my requirement that no welder will enter a vessel such as the heater treater involved in this matter in the absence of myself or another supervisor. It is my opinion that the absence of Mr. Grosbeck [sic] from the work site created a substantial danger of injury to the workers in view of his knowledge of the heater treater, its danger and operation.
It is my further opinion that Mr. Grosbeck [sic] should have given Mr. Moulder and the other workers warning of the dangers involved that arise with inside repair work on a heater treater. It has been my experience that many workers and welders do not appreciate the dangers that can arise absent proper supervision and safety precautions.
From the deposition of Mr. Hardy, a consulting engineer:
Q. From your experience in dealing with the oilfield area here in West Texas and Southeastern New Mexico, with which you have had some dealings, you have had experience here, have you not?
A. Yes, I have.
Q. And, from that experience, from your information, is the propensity for a gas to accumulate in a metal vessel such as this an accepted fact from your experience among oilfield personnel who work with heater treaters either in supervision or working upon those heater treaters?
A. I don't know that to be true, Mr. Crutchfield. I think that certainly those of us who have done investigation work in exploring these problems that would be true. I think *1064 that many times with supervisory people, they may or may not, depending upon what kind of background they have leading to that point. I would doubt very sincerely that you would find many people who are in Mr. Washburn's category, for instance, who would have an understanding and an expectation that this would occur.
* * * * * *
ANSWER: Well, I think from a safety standpoint that when it became apparent that the repairs could not be effected from the outside as planned that an appearance by Mr. Groesbeck to ascertain exactly what the situation was and what should be done in order to keep the people in a safe working condition should have been executed. It was my personal feeling based on this type of situation is that is the time for his appearance.
QUESTION: Or supervision?
ANSWER: Or supervision.
The appellees rely on New Mexico Electric Service Co. v. Montanez, 89 N.M. 278, 551 P.2d 634 (1976) for their authority that Brown is immune from liability. In Montanez the Supreme Court held that §§ 413, 416 and 427 of the Restatement (Second) of Torts (1965) do not extend to workers such as Washburn and Moulder, who are the employees of independent contractors.
Restatement (Second) of Torts § 409 states:
Except as stated in §§ 410-429, the employer of an independent contractor is not liable for physical harm caused to another by an act or omission of the contractor or his servants.
Under that general rule, Brown would not be liable for the harm caused by the acts of Washburn and Moulder. Sections 413, 416 and 427 of the Restatement impose liability on an employer of an independent contractor for harm caused by the independent contractor if he is doing an inherently dangerous activity:
§ 413. Duty to Provide for Taking of Precautions Against Dangers Involved in Work Entrusted to Contractor
One who employs an independent contractor to do work which the employer should recognize as likely to create, during its progress, a peculiar unreasonable risk of physical harm to others unless special precautions are taken, is subject to liability for physical harm caused to them by the absence of such precautions if the employer
(a) fails to provide in the contract that the contractor shall take such precautions, or
(b) fails to exercise reasonable care to provide in some other manner for the taking of such precautions.
§ 416. Work Dangerous in Absence of Special Precautions
One who employs an independent contractor to do work which the employer should recognize as likely to create during its progress a peculiar risk of physical harm to others unless special precautions are taken, is subject to liability for physical harm caused to them by the failure of the contractor to exercise reasonable care to take such precautions, even though the employer has provided for such precautions in the contract or otherwise.
§ 427. Negligence as to Danger Inherent in the Work
One who employs an independent contractor to do work involving a special danger to others which the employer knows or has reason to know to be inherent in or normal to the work, or which he contemplates or has reason to contemplate when making the contract, is subject to liability for physical harm caused to such others by the contractor's failure to take reasonable precautions against such danger.
Washburn and Moulder were both employees of independent contractors hired to repair the heater-treater. The contractors were Triple Six and Star Welding, respectively. Therefore, under Montanez, Brown would not be liable for injuries to Washburn or Moulder under the theories of liability set out in §§ 413, 416 and 427, even if the court did find that repairing a heater-treater *1065 is an inherently dangerous activity. Fresquez v. Southwestern Ind. Con. & Riggers, Inc., 89 N.M. 525, 554 P.2d 986 (Ct. App. 1976). However, the Fresquez court recognized that there is still potential liability under the concept of control. The Supreme Court in Fresquez stated:
Our concern is with the situations in which the duty arises. DeArman v. Popps, 75 N.M. 39, 400 P.2d 215 (1965) quoted extensively from Wolczak v. National Electric Products Corp., 66 N.J. Super. 64, 168 A.2d 412 (1961). Wolczak, supra, indicates liability of the contractor may be based on either of two grounds  control of the premises or control of the work being performed. Wolczak, supra, states:
"Absent control over the job location or direction of the manner in which the delegated tasks are carried out, the general contractor is not liable for injuries to employees of the subcontractor resulting from either the condition of the premises or the manner in which the work is performed."
DeArman v. Popps, 75 N.M. 39, 400 P.2d 215 (1965), addresses the theory of liability of an owner or general contractor to the employees of an independent contractor based on retention of control over the work being done. The control retained by Brown through Groesbeck on the repair of the heater-treater is the operative issue in this case. If there is evidence of control over the work done by the independent contractor, then there is a duty by Brown to Washburn and Moulder. Section 414 of Restatement (Second) of Torts sets out this theory of liability:
One who entrusts work to an independent contractor, but who retains the control of any part of the work is subject to liability for physical harm to others for whose safety the employer owes a duty to exercise reasonable care, which is caused by his failure to exercise his control with reasonable care.
In DeArman, the New Mexico Supreme Court interpreted § 414 to extend liability of the employer to employees of independent contractors. In DeArman, the defendant employer Sunset International Petroleum Corp. had hired an independent contractor, Lawrence Drilling Company, to work on an oil well owned by Sunset. One of Lawrence's employees was subsequently injured at the site. The court in DeArman extended liability of the employer to the employees of the independent contractor. However, the entire operation was overseen by a job superintendent of Sunset and the decision turned on the control retained by Sunset over the job. The injured employee was directly supervised by Sunset's foreman when he was injured. DeArman quotes from the Restatement (Second) of Torts § 414:
Under Comment (a) it is noted that "`* * * The employer may, however, retain control less than that which is necessary to subject him to liability as master. He may retain only the power to direct the order in which the work shall be done * * *. Such a supervisory control may not subject him to liability under the principles of Agency, but he may be liable under the rule stated in this Section unless he exercises his supervisory control with reasonable care so as to prevent the work which he has ordered to be done from causing injury to others.'"
In Restatement of the Law, Torts, § 414, p. 1121, it is further stated under Comment (b):
"The rule stated in this Section is usually, though not exclusively, applicable when a principal contractor entrusts a part of the work to subcontractors but himself or through a foreman superintends the entire job. In such a situation, the principal contractor is subject to liability if he fails to prevent the subcontractors from doing even the details of the work in a way unreasonably dangerous to others, if he knows or by the exercise of reasonable care should know that the subcontractors' work is being so done and has the opportunity to prevent it by exercising the power of control which he has retained in himself. * * *"
*1066 A general contractor or an operator such as Brown can be liable and owes a duty to an employee of an independent contractor when the general contractor or operator retains control of the work to be done. In this case, since the facts regarding the condition of the work and also the issue of control are disputed, we conclude that there are general issues of material fact for the trier of fact or the jury. The trial court improperly granted summary judgment in respect to the issues of inherently dangerous condition and control.

Negligent Supervision
We have decided that there are issues of material fact regarding the control retained by Brown. If Brown retained sufficient control over the repair of the heater-treater, then he had a duty reasonably to supervise the work. Whether he breached that duty is a question of material fact, which should not be decided on motion for summary judgment.

Special Employee
Brown argues that, if he had control over the work, the injured workmen became his special employees, and their exclusive remedy is under the Workmen's Compensation Act. We disagree.
The plaintiffs argue that they did not become special employees of Brown by virtue of the control retained by Brown. The defendants in DeArman made the same claim. The factors used by the Court in DeArman to determine whether DeArman was a special employee of the owner are also applicable to the fact in the present case:
In the instant case DeArman and Lawrence [the independent contractor for whom DeArman worked] were only supervised generally by Popps and Sunset, and conducted their work details in their own manner. Also, DeArman was under the direct supervision of Zumwalt, Lawrence's foreman.
* * * * * *
In the case before us DeArman at all times was paid, employed, and subject to discharge by Lawrence, and Lawrence was hired to do one specific job for Sunset. Lawrence had its own independence of means and methods, subject only to Sunset's general supervision of the desired results. Neither Lawrence nor DeArman were at any time in a position of complete subservience to Sunset, and under the authorities cited, supra, there can be no question that DeArman was an employee of Lawrence and not of Sunset.
We conclude that there are genuine issues of material fact as to the inherent danger of the work that was done, the issue of control, and the issue of breach of duty. Therefore, summary judgment was improperly granted.
The judgment of the trial court is reversed and the case is remanded for proceedings consistent with this opinion. Appellate costs to be paid by Brown.
IT IS SO ORDERED.
WALTERS, C.J., and DONNELLY, J., concur.
