Stable version of cross validation script