Forty squirrels were trained to crack nuts in the new film Charlie and the Chocolate Factory. How?

Even with sophisticated computer-generated technology available, director Tim Burton refused to take any short cuts with the famous Nut Room scene in Roald Dahl's novel.

It had to be as life-like as possible, Burton decided, which meant squirrels cracking and sorting nuts on a conveyor belt.

In the film, they are seen sitting on stools testing the quality of the nuts until their work is rudely interrupted by one of the humans, in an action they take strong exception to.

Some of the squirrels were hand-reared and required bottled milk on set, and others came from squirrel rescues or private homes.

Steve Vedmore, an animal trainer from Brynmawr, south Wales, worked for eight weeks on the film.

The American Humane Association insists that for every animal you use as a hero you have two back-ups, like a human actor has a double

Steve Vedmore, animal trainer

Because of a confidentiality agreement with Warner Bros, he can't reveal exactly what happened on set but, having worked with squirrels before, he says some are easy to train and some aren't.

"The placid ones are good to handle and other ones are aggressive, so we use them as runner animals if we can run them from A to B because they're not good for human contact. They bite."

Training is based on food rewards, so the squirrels got nuts when they did what was required.

"You shape their behaviour so if you're running them from A to B - which could be 100m - you put catching boxes inches away so they run into the box and get a reward. Then you put the box further and further away."

Some worked harder than others, while some filled up on nuts very quickly and then lost interest, he says.

Animal stand-ins

Some of the work is one trainer with one squirrel, but on occasions 10 squirrels are released on a task. This means the aggressive ones have to be released first to stop them attacking others in the pursuit.

All the animals are given names and can be further identified if their fur is clipped in a harmless way, says Mr Vedmore.

Fur is a hard material to realistically portray with computers

"You categorise animals and one could be a good A to B runner but not a hero animal, which is a trick one doing the most intensive work.

"The American Humane Association insists that for every animal you use as a hero you have two back-ups, like a human actor has a stand-in or double that does the running, so you don't burn any one animal out."

Mr Vedmore, who has trained animals for 30 years, says he hasn't come across an animal that can't be trained.

They have very acute hearing, so noises backstage can sometimes be a problem. For the movements squirrels are physically unable to do, special effects computers are used to simulate the action.

Starring role

For the film, the squirrels were used for 10 months, including training, but Mr Vedmore has yet to see his work on screen.

The American Humane Association supervised the training to make sure no animal was made to do anything which might cause it distress. After filming the squirrels were either returned to their owners or adopted by Birds and Animals UK until their next role, because by law, rescued grey squirrels cannot be released into the wild.

Craig Redmond, of the Captive Animals' Protection Society, says: "We always have concerns whenever animals are used in commercials or films, and given the computer technology around these days, I find it surprising the film decided to use live animals."

He says that some animals suffer during training, filming or when trying to adjust to life afterwards.