When Gary Heyward went through training to become a prison guard, his instructor warned him there would be temptations behind those walls.
"He said, 'Look to your left. Now look to your right. One of you is going to smuggle something in, some inmate is going to talk you into doing bad,'" Heyward recalled. "I thought, 'Oh, no, not me.' But, you know, you never think it's going to be you."
Heyward became a corrections officer at New York's Rikers Island in 1996. The former Marine's goal was to start paying down debts, his bills and backed-up child support payments. It was a struggle, he said, on $28,000 a year.
So when an inmate approached him offering $300 for one pack of cigarettes, a high price but one set by a black market created in the prison when the state banned smoking, Heyward went for it, and made the trade.
He rationalized it this way: A lot of the guards carried cigarettes for themselves so it wouldn't be hard to pull off and it's not like cigarettes were illegal drugs. So he did it again, and again. His bills got smaller, and Heyward's reputation as the go-to guard became bigger. "I guess that turned into greed," he said.
One inmate offered $1,500 for a half ounce of cocaine. Soon Heyward was smuggling in coke regularly, he said, as well as cell phones and other contraband.
Caught after an inmate turned him in and he was caught on video, Heyward spent two years in prison.
On a legal pad behind bars he wrote the self-published memoir, "Corruption Officer: From Jail Guard to Perpetrator Inside Rikers Island."
"A lot of people will look at what's going on in New York -- that Joyce lady -- and wonder why," Heyward said. "People do what they do for different reasons. It's just people being human, letting that thing that's most weak in them get the better of them."
Joyce Mitchell, a 51-year-old worker at a New York prison, has been accused of smuggling tools into the facility that helped two murderers escape in early June.
She has told investigators that one of the inmates made her feel "special."
Hacksaw blades smuggled in meat
Sometimes an officer has poor self-esteem and taking a risk makes them feel powerful, or an inmate gives them adoration they crave. Sometimes they get off on the thrill of taking a risk. Overwhelmingly, corruption is borne out of a desire for money, correction officials agree. But it happens, and as long as humans staff prisons, there's no way to completely prevent it.
Mitchell worked in the tailor shop at Clinton Correctional Facility in Dannemora, New York, where authorities say she met inmates David Sweat and Richard Matt.
Heyward recalled that when he first arrived at Rikers, he thought, How would anyone ever get out of here?
"But after awhile it doesn't seem so hard. You see the weak spots," he said. "You see where your opportunities are."
He strapped contraband to his body under his uniform. When the metal detector went off, no one would search him, he said.
A prosecutor said Mitchell put hacksaw blades and drill bits into a hunk of hamburger meat and brought that into the prison; another guard unwittingly placed it in an area where the inmates would be.
Former inmate Erik Jensen appeared on CNN Wednesday describing a flirty relationship that blossomed between Mitchell and one of the inmates.
"It would be (like) when the cute guy at the high school asks the girl to prom and the look on her face every day when they would get together," Jensen said. "They would laugh, giggle -- conversations all day long."
Mitchell has told investigators Matt made her feel special, though she didn't say she was in love with him, a source familiar with the investigation told CNN.
She could go to prison for eight years if convicted.
Was security really maximum at N.Y. prison where killers broke out?
Prisons enemy No. 1? Cell phones
Drugs, weapons, liquor, cigarettes. They are typical contraband. But by far the most dangerous and most desired object is a smartphone, said Jon Ozmint, the former director of the South Carolina Department of Corrections.
Cell phones are routinely stuffed into footballs, bags, volleyballs and thrown over prison walls in the middle of the night. In one instance in 2012, Georgia corrections officials found a dead cat stuffed with cell phones near a prison fence.
"You can't have people policing every parameter of a prison at all times," Ozmint said. "There's usually one person out there and they aren't looking for a football."
Phones allow a prisoner to convey to someone on the outside when and where to toss the contraband, so an inmate during recreation time or just walking across a yard can pick it up. Cell phones have lately been used to tell an outsider when and where to fly a drone over a prison to drop goods.
Prisoners can use social media to keep up their reputation on the outside. Some South Carolina inmates recently posted a rap video from behind bars. Ozmint has seen inmates and gang leaders run their criminal operations on the outside using a phone.
It can be a lucrative endeavor for guards, too. One officer made $150,000 in one year smuggling cell phones to inmates, the Los Angeles Times reported.
Cell phones also can be used to kill. A prisoner ordered a hit on a guard known for cracking down on prisoners' possession of phones in South Carolina, said Ozmint. The guard was shot numerous times but survived.
Ozmint and others have argued that the Federal Communications Commission should allow correctional facilities to jam cell phone signals.
The FCC has said jamming signals to jails and prisons would interfere with surrounding signals.
"Cell phone jamming technology is illegal and causes more problems than it solves," the commission said. "Under current law, the use of technologies that block mobile calls are illegal" and could "interfere with 911 calls and public safety communication."
Nets, body scanners, dogs
Prisons have taken some measures to try to curb the flow of contraband.
Since taking over four Mississippi correctional facilities in 2012 and 2013, Management & Training Corporation has installed 30-foot netting over fences and installed body scanners at entrances, according to the Mississippi Clarion-Ledger newspaper.
They are also using German shepherds to sniff out illegal items in unannounced inspections, the newspaper reported.
Other facilities across the country that didn't have metal detectors have installed them.
In South Carolina, an X-ray machine at the entrance of a facility detected something odd in a saline bag that was passing through on its way to a medical area. Two girlfriends of inmates, working with three inmates, were part of an elaborate scheme to fill saline bags with cell phones and drugs.
They are facing charges. Court documents show their cases are still pending.
But all the technology imaginable isn't going to be as effective at fighting contraband as good, disciplined employees, experts stress.
The best defense is a good offense when it comes to tamping down on contraband, said Joe Giacalone, a retired New York Police detective who has worked closely with prison officials.
"I look at the policies, procedures and the people and see where there was a breakdown," he said. "In New York, if you had effective checks of the facility, maybe they would have found that huge hole those guys who escaped made."
Problems that lead to an elaborate escape like the one in New York are likely to reveal problems throughout a system, Giacalone said.
It's all about the money
He and Ozmint agree that more effective prisons come down to how much a state or a private company wants to invest in running them.
Pay for workers is critical, they argue.
Consider that in March, Mississippi corrections officials found weapons, cell phones and more than 160 "shanks," or homemade knives, at five public and private prisons, the Clarion-Ledger reported. Some staff were "complicit in bringing in the contraband," Corrections Commissioner Marshall Fisher told the newspaper. One employee immediately resigned, he said.
Starting pay for Mississippi correctional officers is $22,000 a year, and the state is considering legislation that would increase the salary, according to the newspaper, which reported that officers had not received a pay raise in eight years.
The 434,870 correctional officers working in the United States in 2011 earned an average annual salary of $43,550, the U.S. Bureau of Labor Statistics reported. Officers in the lowest 10% of the profession earned $27,000 or less.
In South Carolina, where the inmates and girlfriends were charged last year with smuggling cell phones and drugs into prison, a correctional officer's starting salary is around $24,000, Ozmint said.
Is it possible to raise standards for prospective correctional officers and make psychological screening more stringent?
Right now, Ozmint said, a 21-year-old can become a guard after passing a criminal background test, taking a psych test and going through an in-person interview.
That's not much more than any other job applicant would be required to do.
A legislature has to raise pay, and if standards for screening are going to be improved, initially that will cause fewer people to apply, Ozmint said.
"If I raise standards, if I make it harder to become a correctional officer, I'm going to have fewer professionals watching inmates in those prisons," he said. "That isn't the solution."
Most staff start their jobs honest, he said. "When they cross the line it will usually be a situation where they tried to help an inmate. The staffer thinks they are only helping a heart-wrenching situation, but all of a sudden they've broken a rule."
The inmate has blackmail material, Ozmint said. "Suddenly the inmate has the control."
Often there's a complex, slow dance an inmate is choreographing to win over a guard, he and Giacalone said.
"It's usually love, money and or drugs," said Giacalone. "Those are usually the motivations. Maybe there are others, but you'll find at least one of those."
It's also important to remember that correctional workers and inmates are in a unique environment that can -- especially when an inmate is not paid much -- breed a sense of shared punishment.
"In a correctional environment, these workers are kind of prisoners themselves," Giacalone said. "They are locked up for hours -- 12- or 18-hour shifts -- with these inmates."
Gary Heyward, the corrupted guard, doesn't make excuses for what he did. And he warns against thinking there's an easy solution to preventing bad behavior.
"There's no blueprint," he said. "I've seen highly educated professionals who seem to have it all together do some crazy things inside the jail. Anyone has the potential to break the rules. Anyone."