rewrite the solution