Improve the solution a bit but there are still some failures.