Cross-validation function adepted