adding cross validation code