generalized group_by_author to fix a bug
added a routine for crossvalidation