Minor improvements to solution.