Opinion by
Judge Rogers,Roosevelt Benjamin (appellant) has appealed from an order of the Court of Common Pleas of Allegheny County refusing the prayer of his petition for a writ of habeas corpus which would effect his release from the 'State Correctional Institution at Pittsburgh (S'CIP). In the petition, which Benjamin prepared, it is alleged that because the Bureau of Corrections has failed to segregate prisoners with histories of mental illness from the general prison population, he is subjected to cruel and unusual punishment in violation of the Eighth Amendment to the Constitution of the United States. The named respondents are the Superintendent of SiCIP and the Attorney General of Pennsylvania.
The hearing judge appointed counsel to represent the appellant and conducted a hearing. At the hearing, counsel for the appellant, citing Section 3 of the Act of May 10, 1921, P.L. 433, as amended, 61 P.S. §3, which requires that prisoners “who are found to be mentally weak shall be segregated from the other prisoners,” asked the trial court to treat the appellant’s petition for a writ of habeas corpus as. a petition for a writ of mandamus and to order the respondents to enforce the statute.
*343After hearing the testimony of a psychiatrist and á clinical psychologist employed at .SCIP, who were called by the appellant, the trial judge found that the Act of May 10, 1921 was being observed at SCIP and that the appellant had not proved that the conditions of his confinement constitued cruel and unusual punishment.
On .appeal the appellant .first contends that the trial court committed an error of law by refusing to treat his petition for a .writ of habeas corpus as a petition for a writ of mandamus. His principal authority for this proposition is Haines v. Kerner, 404 U.S. 519 (1972), a case much different from this. In Haines, the petitioner, an inmate at the Illinois State Penitentiary, filed an inartfully drawn complaint alleging violations of his civil rights. ¡The District Court granted'the State respondents’ motion to dismiss for failure to state a claim upon which relief could be granted and the Court of Appeals affirmed. The United States Supreme Court reversed, holding that pro se complaints are to be held to less stringent pleading standards than those drafted by lawyers and that the District Court should not have dismissed the petitioner’s complaint without hearing the petitioner’s evidence. The appellant Benjamin’s petition for writ of habeas corpus is not ineffectively drafted; it clearly bases its prayer for relief on the claim that he is •subjected to cruel and unusual punishment by reason of the failure of the respondents to segregate mentally weak inmates. The trial court appointed effective counsel who ably adduced the testimony of witnesses in the petitioner’s behalf. We find no merit in .the contention that Haines v. Kerner required the hearing judge to act otherwise than he did in this case.
The appellant next contends that the trial court committed an error of law by refusing to issue the writ of habeas corpus. We disagree.
*344Commonwealth ex rel. Bryant v. Hendrick, 444 Pa. 83, 280 A.2d 110 (1971), stands for the proposition that habeas corpus is available to seek relief from a confinement under conditions which amount to cruel and unusual punishment, even though the detention itself is legal. The ¡Supreme ¡Court, however, expressed a ¡caveat i
We do not mean to indicate by our present ruling that it is the function of the courts to superintend the treatment and discipline of prisoners in penal institutions. This is the responsibility of those in charge of the prison itself and those officers, both state and local, who are given ¡supervisory powers. We also emphasize that habeas corpus should not ibe entertained on the slightest pretext .or merely to correct prison conditions which can be remedied through an appeal to prison authorities or to an administrative agency. But, we do mean that where the conditions of the confinement are so cruel and callous as the evidence in the present case establishes, the courts may grant relief through habeas corpus in order to protect the petitioner ’¡s fundamental and basic rights.
Id. at 90, 280 A.2d at 113. The finding of the trial court that the conditions of the appellant Benjamin’s confinement are not cruel or unusual is firmly supported in this record. The evidence, which the appellant adduced, is to the effect that the authorities at SCIP are maintaining a responsible program of identifying, treating and ¡segregating mentally weak prisoners. Dr. Herbert E. Thomas, a psychiatric consultant at SCIP, .testified that the authorities have established procedures for quickly identifying those prisoners who become aggressive because of mental illness, that inmates who are extremely disturbed or psychotic are placed in separate observation cells or *345other restrictive housing, and that inmates who are found to be dangerous to themselves or ethers are transferred to another institution.
Order affirmed.
Order
And Now, this 5th day of February, 1985, the order of the Court of Common Pleas of Allegheny County in the above-captioned matter is affirmed.