another overhaul to subsample routine