Code rewrite 2