Cranius Maximus, Agent Doof

When Baljeet becomes concerned that he is losing his mental edge, the boys invent a cerebral stimulatory hat, or "Brain booster," to help him. But when the hat exceeds expectations and makes Baljeet exponentially smarter, he suddenly views everyone else as beneath him and becomes a threat to civilization by taking Earth's atmosphere and bringing it to the moon. Meanwhile, Dr. Doofenshmirtz plans to use his "Key-Find-Inator" to collect all the keys in Danville in hopes that it will lead to the Key to the City.
Candace's plans to watch over Phineas and Ferb backfire when Dr. Doofenshmirtz's "Babe-inator" turns her brothers into babies. After having an epiphany, Dr. Doofenshmirtz shows up at the OWCA to give up his evil ways. Agent P has no choice but to show Dr. Doofenshmirtz the ropes of the trade, but things quickly sour between the two after Dr. Doofenshmirtz accidentally exposes the identity of a fellow animal agent.