
404 N.W.2d 807 (1987)
In re the Marriage of Charles BETTIN, petitioner, Respondent,
v.
Brenda Lea BETTIN, Appellant.
No. C3-86-1740.
Court of Appeals of Minnesota.
April 21, 1987.
Richard Berens, Johnson, Berens & Wilson, Fairmont, for respondent.
Obert Knutson, Southern Minnesota Regional Legal Services, Inc., Mankato, for appellant.
John G. Lubitz, Erickson, Zierke, Kuderer, Myster, Madsen & Wollschlager, P.A., Fairmont, for Guardian Ad Litem.
Considered and decided by CRIPPEN, P.J., and WOZNIAK and STONE[*], JJ., with oral argument waived.

OPINION
WOZNIAK, Judge.
This appeal is from an amended judgment and decree in a post-dissolution action modifying custody. We affirm.

FACTS
Brenda Lea Bettin (appellant) and Charles Bettin (respondent) were divorced on April 13, 1983. The dissolution judgment and decree awarded Brenda custody of the parties' then unborn child. Charles *808 Eugene Bettin was born on September 5, 1983. Pursuant to an amended judgment entered on April 15, 1985, Brenda was awarded custody of the child and Charles was awarded visitation rights. Brenda cared for the child from birth, subject to Charles's visitation rights until the fall of 1985, when the parties agreed that Charles would care for the child indefinitely while Brenda underwent and recovered from a hysterectomy surgery.
After the operation, Charles had the child between July 1985 and April 1986 as custodian in fact or by court order. Blaine Brown then moved in with Brenda, whereupon Charles refused to return the child upon Brenda's request. Charles then moved the trial court to change custody. Brenda filed a countermotion to dismiss Charles's motion and to enforce the original custody order.
In the affidavit supporting his motion, Charles claimed (1) that Brenda associated with Brown, who had been charged with criminal sexual conduct for an alleged sexual penetration of his four-year old daughter, (2) that Brown had other criminal convictions which proved him to be an unstable person, and (3) that the parties' child had been integrated into Charles's home with Brenda's consent.
Pending trial, the court restored physical custody of the child to Brenda on the condition that Brown have no contact with the child, and that Brenda and the child live with Brenda's father. The court later ordered that Brenda have no contact with Brown in person, by telephone, or in writing. Brenda saw Brown on several occasions, prompting the court to return the child to Charles's custody on April 2, 1986.
At trial, the court heard the testimony of 13 witnesses, received a written recommendation from the guardian ad litem, and received a psychological report and recommendation from the court-appointed psychologist, Dr. Long. The court granted Charles's motion for a custody modification, awarding legal and physical custody to Charles. Brenda made a motion for amended findings of fact and conclusions of law, but an appeal was taken prior to a decision to protect the appeal period.

ISSUE
Did the trial court abuse its discretion in modifying custody by making findings unsupported by the evidence or by improperly applying the law?

ANALYSIS
Appellate review of custody determinations is limited to whether the trial court abused its discretion by making findings unsupported by the evidence or by improperly applying the law. Pikula v. Pikula, 374 N.W.2d 705, 710 (Minn.1985). This court views the evidence in the light most favorable to the trial court's findings. See Hansen v. Hansen, 284 Minn. 1, 5, 169 N.W.2d 12, 15 (1969). The findings will be sustained unless clearly erroneous. Pikula, 374 N.W.2d at 710. The guiding principle is the best interests of the child. Id. at 711; see Minn.Stat. § 518.17, subd. 3 (1984).
Brenda contends that in transferring custody to Charles, the trial court failed to apply the custody modification standards mandated by Minn.Stat. § 518.18 (1984). Under this section, modification of custody requires the trial court to conduct a four-part test, making specific findings that (1) a change of circumstances has occurred; (2) a modification is necessary to serve the child's best interests; (3) the child's present environment endangers the child's health or impairs his emotional development; and (4) the harm likely caused by the change is outweighed by the advantages of the change. See id. (d)(iii); State ex rel. Gunderson v. Preuss, 336 N.W.2d 546, 548 (Minn.1983).

A. Change of Circumstances
Brenda claims that there has been no change of circumstances justifying a change in custody. The statute requires either a showing that the circumstances have changed or that facts unknown to the court at the prior custody determination have now been disclosed. The trial court found:

*809 (1) Brenda Lea Bettin has received psychological counseling since October 1985; (2) Court-appointed psychologist reports that Brenda needs a one-year period without custody of the child to better prepare herself for the obligations of being mother and custodian to the child; (3) Brenda has established a relationship with Blaine Brown, whom she knows has gone to alcohol treatment and has recently been taken to detox for detoxification, who has been convicted of assault, and was charged with criminal sexual conduct in the first degree with respect to a child. Knowing all of this she believes in his innocence of the charge and believes that he will not drink while with her or the child.
The court-appointed psychologist's report disclosed that Brenda was voluntarily undergoing counseling for chemical dependency and, although not chemically dependent, she had a propensity to abuse drugs. Brenda was also on medication and participating in counseling for a "severe psychosomatic problem" which caused her gastro-intestinal disorders. The report noted that Brenda was unemployed and had no vocational training, and that her ability to locate and maintain a job while caring for the child was uncertain, due to her psychosomatic illness. The psychologist recommended that Brenda have at least a year to receive vocational training, become employed, resolve her emotional problems, and demonstrate that she is capable of handling the responsibilities attendant to parenting.
The evidence of Brenda's emotional problems and her relationship with Brown supports the trial court's conclusion that circumstances have changed since the initial award of custody.

B. Best Interests
The trial court concluded that modification is necessary to serve the child's best interests. In addition to the findings regarding counseling and the need to prepare herself for the responsibilities of parenting, the trial court found that Brenda was a "dependent individual." The evidence showed that she was unemployed, had a nervous condition, and had not provided a stable home environment for her child. Witnesses testified that she was seen at 1:00 a.m. holding the child in the doorway of her home. The guardian ad litem stated that upon visiting her home at 11:00 a.m., the child had just awakened, was very tired, and was eating candy and drinking soda pop. The guardian stated that the child appeared to be "fearful of inappropriate things and that he became agitated by normal noise from neighbors." During another visit, the guardian noted that the child appeared more rested, but still very nervous. Her report further stated that Brenda "exhibited * * * a lack of concern for [the child's] welfare while he was in her custody." She noted that Brenda was nonchalant when informed that her phone would be disconnected for nonpayment of her bill, and failed to notify her financial worker for needed AFDC until after she had custody of the child for several days. Both the court-appointed psychologist and the guardian ad litem recommended that the child be placed with respondent.
Brenda argues that Dr. Long stated that she did not have any physical or emotional problems which would prevent her from having custody of her son. This testimony, however, is taken out of context and disregards the psychologist's conclusion that Brenda needed time to resolve her problems and to handle the responsibilities of parenthood. The trial court's findings regarding the necessity for modification are well-supported by the evidence.

C. Endangerment/Impairment
The trial court concluded that the child's physical and emotional health is endangered and his emotional development is impaired by his present environment. As discussed above, the trial court made specific findings regarding Brenda's relationship with Brown. Although she has every right to believe in Brown's innocence of the criminal charges, with the evidence before it, the court properly prohibited Brenda from allowing Brown to see her son. Sufficient evidence exists to support a conclusion that *810 the child's present environment endangers his physical and emotional health.
Brenda argues that the trial court's conclusion of endangerment was based upon the erroneous finding that Brown had been charged with criminal sexual assault of her child. In its findings, the trial court stated that Charles refused to return the child to Brenda "because of the presence of Blaine Brown who was charged with Criminal Sexual Abuse in the First Degree of the child." Although the findings contain this error, we are satisfied from our review of the record that the court fully understood the actual situation. In another part of its findings, the court accurately stated that Brown had been "convicted of Assault and was charged with Criminal Sexual Conduct in the First Degree with respect to a child." Further, the court had before it a copy of the criminal complaint which clearly identified the allegedly abused child.
In further support of its conclusion of endangerment or impairment, the court found:
that upon [the child's] transfer to respondent, the child was hyperactive, had a delayed speech development for his age, and was underweight;
that after an extended visit with respondent and his wife, who has a degree in elementary education, the child's behavior and speech improved greatly;
that upon returning from visiting his mother, the child was whiny, undisciplined, and required attention to eat properly.
Brenda claims that the testimony of Rhonda Hoppe, a child protection worker, is contrary to the conclusion that the child's emotional development would be impaired if custody were returned to her. Hoppe testified that the child's development was normal for his age. Hoppe, however, did not observe the child until after he had been in Charles's care for several months. Moreover, Charles, his wife, members of their family, and friends testified that when Charles first obtained custody, the child was underweight, had poor eating habits and speech deficiencies, and was withdrawn, nervous, and undisciplined. The witnesses testified that these ailments disappeared while the child remained in his father's custody, but reappeared to a certain extent after visitations with Brenda.
Brenda lastly argues the court's finding regarding her counseling does not support endangerment. Although she should not be penalized for undergoing counseling, and this factor by itself would not support a conclusion of endangerment, the totality of the circumstances must be examined with the best interests of the child in mind. We hold that the court's findings regarding endangerment and impairment of the child's health were supported by the evidence.

D. Balancing Test
The trial court held that the harm which could arise from the change of custody had been negated by the extended period of time that the child had lived with his father. The court found that "respondent's home had been excellent for the development and improvement of the living conditions of the child." Dr. Long's report indicated that Charles and his wife Betty have a stable married life and that, although Charles lost an arm in a work-related accident in 1983, he appeared to have his injury in perspective and is attempting to find work to which he can adapt. Betty works outside the home, and Charles works part-time and cares for the children part-time. Dr. Long concluded that Charles's home provided the most stable environment for the child. The guardian ad litem also recommended Charles's home.
Brenda, however, claims that since she was the primary caretaker from the child's birth, under Pikula it was an abuse of discretion to transfer custody to Charles. The Pikula court stated that a preference arises to maintain custody in the parent who was the primary caretaker. 374 N.W.2d at 713. Nevertheless, this preference vanishes if the child's physical or emotional health is likely to be endangered or impaired by being placed in the primary parent's custody. Id. at 714. We hold that the record supports the trial court's conclusion that the disadvantages of the change *811 in custody were outweighed by the advantages.

Temporary Order
Brenda argues that the trial court cannot enter an order temporarily placing the child in the custody of his father for one year. Her conclusion is erroneous. Although the court can enter such an order pursuant to Minn.Stat. § 518.17, subd. 3 (providing that the trial court may enter an order regarding custody as it deems "just and proper"), in this case the court's findings merely refer to a one-year period needed by Brenda to prepare herself to meet the obligations of a parent. The order does not grant temporary custody of the child to Charles, nor does it provide for a review hearing to determine whether Brenda has demonstrated her ability to meet these responsibilities and regain custody. Instead, the court awarded permanent custody to respondent.

DECISION
The trial court did not abuse its discretion in granting custody to respondent, as the record supports its findings and the law was properly applied.
Affirmed.
NOTES
[*]  Acting as judge of the Court of Appeals by appointment pursuant to Minn. Const. art. 6, § 2.
