new internal function for data subset handling