modify for high dimensional data