greatly improve performance of subsetting