Instead of yelling and spanking which don't work anyway I believe in finding creative ways to keep their attention - turning things into a game for instance. And when they do something good positive reinforcement and praise.
As a former career intelligence professional I have a profound appreciation for the value of intelligence. Intelligence disrupts terrorist plots and thwarts attacks. Intelligence saves lives.