At times, we traded stories like two stiffs who had worked for the same, caustic boss.

But between the two of us, only Joe Muto actually had stepped inside the walls of Fox News Channel as an employee, working his way up a succession of jobs to become a producer on the news channel's top show, The O'Reilly Factor.

That's when Muto's liberal leanings and admitted burnout at Fox led to a questionable decision: To file reports for the website Gawker as a "mole" at the news channel, hopefully to describe life behind the scenes at TV's top-rated cable news outlet.

Unfortunately for Muto, he was discovered after providing just two posts — one with embarrassing, unaired footage of GOP presidential candidate Mitt Romney talking about his show horses and another describing the awful state of bathrooms at the channel.

"I just wanted to be more of a lovable goofball and I think it may have crossed over into criminally negligent," said Muto, who eventually was identified by Fox, fired and prosecuted, pleading guilty to two misdemeanor charges. "If I had known I was going to end up being led by handcuffs into a courtroom to plead guilty to misdemeanors, I wouldn't have done it at all."

So he wrote the recently released An Atheist in the Foxhole, a book aimed at expanding on his backstage accounts, describing eight years working at Fox News. As somebody who tangled with Muto's boss more than once, I found the middle sections a compelling, detailed look at how cable's top anchor chooses stories and develops his onscreen image.

"The stories he was looking for had to be ones that, first and foremost, would get him viewers," Muto wrote, later describing an obsession with ratings that would lead Bill O'Reilly to pore over daily viewership figures in 15-minute increments, questioning which topics or guests would bring dips in the totals.

"Beyond that, he was looking for stories that supported his world view: that American culture and society was under assault by the forces of secular liberalism, and that he, Bill O'Reilly, was the only thing standing between the secularists and the total dissolution of the nation's moral fiber," the book continued.

Well-written and structured in surprising ways, the book takes the events of the day in which he was discovered and fired by Fox and sprinkles them throughout the text.

For media nerds, the material on O'Reilly is interesting, as Muto describes a broadcaster brilliant enough to dictate show scripts while riding into the office from home, but petty enough to deliver the same angry rebuke to a producer who provides incorrect information or a secretary who gets a lunch order wrong.

That sense of retribution, Muto suggested, may also be why O'Reilly has crossed swords with so many TV critics — including me — looking into writers' political donations, party registrations and, in my case, past writing on racial issues.

"My sense is that he has a chip on his shoulder," said the former producer, noting that O'Reilly gets daily reports on which media outlets have mentioned him in their stories. "He thinks no one will give him the credit, that media critics love to look at other people like Anderson Cooper or Morning Joe on MSNBC … meanwhile, he's still Number One and critics are ignoring him."

Despite describing himself as a liberal who tamped down his political views to work at Fox, Muto had kind words for conservative icon O'Reilly, calling him a "self-made man" and "master of the medium," even while describing his distaste in participating in an ambush interview of Rosie O'Donnell for the show.

He also revealed that the highly profitable network had a rickety system of getting videotapes on the air during most of his tenure, which often left junior staffers with lots of power over what images aired with stories.

According to Muto, many of his colleagues at Fox didn't believe the channel's public posture that Fox News is "fair and balanced" while countering the liberal bias of mainstream media. "Everyone knew that our job was to sort of stir up viewers and make them angry and, you know, get them to watch more," he said. "Because angry people keep media on for longer, basically."

By the book's end, Muto writes he would most like to see Fox News Channel "drop the veil" and present its pro-conservative partisanship openly. "I'd want (founder and president) Roger Ailes to come out and say … it's harmful to the discourse and harmful to our viewers when we pretend we're the fair ones and everybody else is biased."

So why don't they do that?

"I think the network still craves legitimacy," Muto said. "Everyone knew we're the partisan network. But they want plausible deniability. (They) worry if they went over all the way, then people would just be able to write them off as the crazy, right-wing network."