added a bit of crossvalidation