Moving towards llvm-like hierarchy of ownership.

* Fixed a few of thousands memory leaks :)