2D implementation