Restructured the solution