Implemented Solution 2