Added checkSolution method