Can you rewrite the code with the solution you proposed?