delivered the opinion of the court:
A jury convicted the defendant, Keith Jamison, of residential burglary (Ill. Rev. Stat. 1989, ch. 38, par. 19 — 3). The trial court sentenced him to a four-year term of imprisonment. The defendant appeals.
At trial, Marianne Barcus testified that on October 5, 1989, around 9:30 a.m., she left her home to go shopping. When she returned about 10:45 a.m., she saw her front door close and a black man run from the porch. She noted that he was wearing a cap and a blue coat with a red stripe. Finding the doorjamb broken, she ran to her neighbor, Judy Nagra. The two women then called the police.
Barcus returned to her home a short while later. She noticed a cane and a board in the hallway, some torn woodwork, and a broken chandelier. However, nothing appeared to be stolen.
Judy Nagra testified that around 10:30 or 11 a.m. on October 5, she noticed two black men standing near Barcus’ driveway. One man, who wore a cap and a blue baseball jacket with a red stripe, was hitting a. tree with a board. The other man, who wore a cap and a gray jogging suit, was holding a cane. She stated in court that the second man was the defendant. Shortly after she observed them, the two men walked off. No more than five minutes later, Barcus came to Nagra’s door and told her that her house had been broken into. She then joined Barcus in calling the police and providing descriptions of the men.
Officer Michael Garland testified that he heard a report that two men involved in a possible burglary had fled the scene and were headed toward Summit Street. While patrolling the area, he saw two men standing in a side yard facing Summit Street. The two men fled when Garland left his car to approach them.
Officer James Ryan testified that he also heard a report about a possible burglary. When he saw two men standing in the middle of Summit Street, he chased them. However, he fell and lost sight of them.
Officer Ronald Nagra testified that he heard Ryan’s transmissions about what he had seen and also received information about a man running near a body shop. When he searched the shop area, he saw the defendant crouched behind a small shed. He then drew his gun, *567placed the defendant against a wall, and began searching him. When the defendant resisted the search, the two men struggled and rolled down a hill. Officer Garland then assisted Nagra in taking the defendant into custody.
A police technician testified that fingerprints he obtained from the cane and board could not be compared with those of the defendant. However, he was able to determine that a palm print found on the door did not match the defendant’s palm. A second technician testified that a shoe impression found on the door did not match the defendant’s shoes.
The parties subsequently met to discuss jury instructions. The trial court decided to give instructions referring only to the defendant’s guilt as a principal, i.e., whether he personally entered the Barcus home.
In closing arguments, the State pointed to the evidence regarding the cane as proof of the defendant’s entry into the home. The defendant conceded that a break-in had occurred, but argued that the State had failed to prove he actually entered the home.
During deliberations, the jury posed the following question to the court:
“Can a person who was an accomplice to Residential Burglary not entering into the home be charged with Residential Burglary?”
Over the defendant’s objection, the court responded by giving the standard jury instructions on accountability (Illinois Pattern Jury Instructions, Criminal, Nos. 5.03, 14.10 (2d ed. Supp. 1989)). Thereafter, the jury found the defendant guilty of residential burglary.
On appeal, the defendant argues that the court erred in responding to the jury’s question. Pointing out that he had been charged and tried as a principal, he contends that at that point in the trial the court should not have introduced accountability as an issue. The State argues that the court properly instructed the jury and, alternatively, that the error was harmless because there was sufficient evidence to convict the defendant as a principal.
The response to a jury communication is within the trial court’s sound discretion. (See People v. Queen (1974), 56 Ill. 2d 560, 310 N.E.2d 166.) Where the jury indicates that it is confused about a matter at issue in the trial, the court has a duty to clarify the matter. (People v. Reid (1990), 136 Ill. 2d 27, 554 N.E.2d 174.) In so doing, however, it must not unduly prejudice the defendant or favor the prosecution in the eyes of the jurors. See, e.g., People v. Sampson (1980), 86 Ill. App. 3d 687, 408 N.E.2d 3.
*568 We note that the information and the initial jury instructions referred only to the defendant’s guilt as a principal. Both parties therefore limited their arguments to the question of whether the defendant was guilty as a principal. The trial court’s supplemental instructions allowed the defendant to be convicted on a theory that was not addressed at trial. We therefore find that this was an abuse of discretion.
Turning to the question of whether the error was harmless, we note that an error shall be deemed harmless only if the record shows it did not prejudice the defendant. (People v. Carlson (1982), 92 Ill. 2d 440, 442 N.E.2d 504.) Here, the jury’s question shows that it was concerned with the defendant’s guilt as an accomplice. Additionally, there was some doubt about the defendant’s guilt as a principal, because no witness testified to seeing him in the home and the fingerprint evidence was inconclusive. We therefore find that the error was not harmless.
The defendant further argues that he was not proved guilty beyond a reasonable doubt because the State failed to show that he entered the home with the intent to commit a theft. In resolving this issue, we must view all of the evidence in the light most favorable to the State to determine whether a rational trier of fact could have found the defendant guilty beyond a reasonable doubt. (People v. Collins (1985), 106 Ill. 2d 237, 478 N.E.2d 267.) Applying this standard, we find that the evidence established the requisite intent. We therefore reverse the defendant’s conviction and remand the cause for a new trial.
The judgment of the circuit court of Will County is reversed, and the cause is remanded for further proceedings consistent with this opinion.
Reversed and remanded.
BARRY and GORMAN, JJ., concur.