em working version for 2D
not working for 2d multivariate