Implemented the solution.