exercise2 rewrite