works in 2d