redo subsample as a class