Code adaptable to both solution and solutionset elements