Rewrite sample code with latest style.