rewrite code 2