Added cross-validation handling.