Solved implementation