Added 2D density code