implemented the solution