refactoring into new cvtools and cvtest packages