Added 2D example. Changed weight parameter to weight squared (this helps the optimization massively, especially in 2D).