Working for 2D problem fine