Move object hierarchy to smart pointers.
Python garbage collecting now working without problems.