My take on the solution.