I moved the first part of the solution to the hints and slightly adjusted the solution. Please re-review and flag accordingly.