code rewrite p.4