more changes to sub-sample routine