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.
Life is divided into three terms - that which was which is and which will be. Let us learn from the past to profit by the present and from the present to live better in the future.