Index: trunk/nv/gui/gui_environment.hh
===================================================================
--- trunk/nv/gui/gui_environment.hh	(revision 263)
+++ trunk/nv/gui/gui_environment.hh	(revision 264)
@@ -33,5 +33,5 @@
 		};
 
-		class environment : public root
+		class environment
 		{
 		public:
@@ -44,7 +44,10 @@
 			void update();
 			void draw();
-			virtual void add_child( object* child );
+			void add_child( element* child );
+			void destroy_element( element* e );
+			void destroy_children( element* e );
 			virtual ~environment();
 		protected:
+
 			renderer*    m_renderer;
 			window*      m_window;
Index: trunk/nv/root.hh
===================================================================
--- trunk/nv/root.hh	(revision 263)
+++ trunk/nv/root.hh	(revision 264)
@@ -17,8 +17,8 @@
 	 * Implements the root of a object tree-like structure.
 	 */
-	class root : public object
+	class root 
 	{
 	public:
-		root() : object( "" ), m_lua_state( nullptr ), m_uid_store( nullptr ) {}
+		root() : m_lua_state( nullptr ), m_uid_store( nullptr ) {}
 		lua::state*    get_lua_state()     const { return m_lua_state; }
 		uid_store*     get_uid_store()     const { return m_uid_store; }
@@ -33,5 +33,5 @@
 		void destroy_children( object* o );
 		virtual void destroy_object( object* o );
-		virtual ~root() { destroy_object( this ); }
+		virtual ~root() {}
 	protected:
 		virtual void object_created( object* o );
@@ -40,5 +40,5 @@
 		uid_store*     m_uid_store; 
 	};
-
+	
 } // namespace nv
 
Index: trunk/src/gui/gui_environment.cc
===================================================================
--- trunk/src/gui/gui_environment.cc	(revision 263)
+++ trunk/src/gui/gui_environment.cc	(revision 264)
@@ -36,5 +36,4 @@
 	m_screen = new screen( m_area );
 	m_renderer = new renderer( w, shader_path );
-	root::add_child( m_screen );
 }
 
@@ -47,8 +46,14 @@
 {
 	element* result = new element( r );
-	object_created( result );
 	if ( parent == nullptr ) parent = m_screen;
 	parent->add_child( result );
 	return result;
+}
+
+void nv::gui::environment::destroy_element( element* e )
+{
+	destroy_children( e );
+	e->detach();
+	delete e;
 }
 
@@ -94,13 +99,21 @@
 }
 
-void environment::add_child( object* child )
+void environment::add_child( element* child )
 {
-	// TODO: check if element
 	m_screen->add_child( child );
 }
 
+void environment::destroy_children( element* e )
+{
+	while ( !e->m_children.empty() )
+	{
+		destroy_element( (element*)e->m_children.front() );
+	}
+}
+
+
 environment::~environment()
 {
-	destroy_children( this );
+	destroy_element( m_screen );
 	delete m_renderer;
 }
Index: trunk/src/root.cc
===================================================================
--- trunk/src/root.cc	(revision 263)
+++ trunk/src/root.cc	(revision 264)
@@ -30,5 +30,5 @@
 		m_uid_store->remove( o->m_uid );
 	}
-	if ( o != this)	delete o;
+	delete o;
 }
 
