moved subsetting function so that it only has to be run once per site -- to save memory