Added grid to lambda conversion.

* Haven't tested it yet.
* Moved all conversion stuff to its own class.
* Added an exception for an error while converting grids to lambdas.