altered to class hierarchy architecture for better crossval implementation