Added sub-sampling option.