Index: trunk/src/gui/gui_ascii_renderer.cc
===================================================================
--- trunk/src/gui/gui_ascii_renderer.cc	(revision 437)
+++ trunk/src/gui/gui_ascii_renderer.cc	(revision 440)
@@ -49,6 +49,5 @@
 		er->clear = true;
 		int color = 0;
-		std::string path;
-		std::string text;
+		string128 path;
 		const char* stext[] = { nullptr, "selected", "hover" };
 		const char* selector = stext[0];
Index: trunk/src/gui/gui_environment.cc
===================================================================
--- trunk/src/gui/gui_environment.cc	(revision 437)
+++ trunk/src/gui/gui_environment.cc	(revision 440)
@@ -9,6 +9,4 @@
 #include "nv/gui/gui_renderer.hh"
 
-#include <algorithm> // std::find on std::list
-
 	/*
 
@@ -27,4 +25,5 @@
 	: m_renderer( r )
 {
+	r->set_environment( this );
 	m_screen   = create_element( handle(), m_renderer->get_area() );
 }
@@ -161,5 +160,5 @@
 		while ( !parent->m_children.empty() )
 		{
-			destroy_element( parent->m_children.front() );
+			destroy_element( parent->m_children.back() );
 		}
 	}
@@ -196,4 +195,9 @@
 }
 
+nv::string_view nv::gui::environment::get_string( shash64 h )
+{
+	return m_strings[h];
+}
+
 bool nv::gui::environment::set_selected( handle e )
 {
@@ -235,5 +239,5 @@
 
 	handle result;
-	element::list::reverse_iterator it = el->m_children.rbegin();
+	auto it = el->m_children.rbegin();
 
 	while ( it != el->m_children.rend() )
@@ -254,5 +258,5 @@
 	if ( e && parent )
 	{
-		auto it = std::find( parent->m_children.begin(), parent->m_children.end(), child );
+		auto it = find( parent->m_children.begin(), parent->m_children.end(), child );
 		if ( it != parent->m_children.end() )
 		{
@@ -264,20 +268,4 @@
 }
 
-void nv::gui::environment::move_to_bottom( handle child )
-{
-	element* e      = m_elements.get( child );
-	element* parent = m_elements.get( e->m_parent );
-	if ( e && parent )
-	{
-		auto it = std::find( parent->m_children.begin(), parent->m_children.end(), child );
-		if ( it != parent->m_children.end() )
-		{
-			parent->m_children.erase( it );
-			parent->m_children.push_front( child );
-			parent->m_flags[DIRTY] = true;
-		}
-	}
-}
-
 void nv::gui::environment::set_relative( handle e, const rectangle& r )
 {
@@ -312,20 +300,20 @@
 }
 
-void nv::gui::environment::set_class( handle e, const std::string& text )
+void nv::gui::environment::set_class( handle e, const string_view& text )
 {
 	element* ep = m_elements.get(e);
 	if ( ep != nullptr )
 	{
-		ep->m_class        = text;
+		ep->m_class        = m_strings.insert( text );
 		ep->m_flags[DIRTY] = true;
 	}
 }
 
-void nv::gui::environment::set_text( handle e, const std::string& text )
+void nv::gui::environment::set_text( handle e, const string_twine& text )
 {
 	element* ep = m_elements.get(e);
 	if ( ep != nullptr )
 	{
-		ep->m_text         = text;
+		ep->m_text.assign( text );
 		ep->m_flags[DIRTY] = true;
 	}
@@ -337,12 +325,12 @@
 	if ( p )
 	{
-		auto it = std::find( p->m_children.begin(), p->m_children.end(), child );
+		auto it = find( p->m_children.begin(), p->m_children.end(), child );
 		if ( it != p->m_children.end() )
 		{
 			element* e = m_elements.get( *it );
 			e->m_parent = handle();
-			p->m_children.erase(it);
-		}	
-	}
-}
-
+			p->m_children.erase( it );
+		}
+	}
+}
+
Index: trunk/src/gui/gui_gfx_renderer.cc
===================================================================
--- trunk/src/gui/gui_gfx_renderer.cc	(revision 437)
+++ trunk/src/gui/gui_gfx_renderer.cc	(revision 440)
@@ -243,7 +243,6 @@
 		int border = 0;
 		vec4 color;
-		std::string path;
-		std::string text;
-		const char* stext[] = { nullptr, "selected", "hover" };
+		string128 path;
+		const char* stext[] = { "", "selected", "hover" };
 		const char* selector = stext[border];
 		if ( e->m_flags[HOVER] )    selector = stext[2];
@@ -252,5 +251,5 @@
 		if ( m_style.get( e, "skin", selector, path ) )
 		{
-			size_t image_id = load_image( string_view( path.c_str(), path.size() ) );
+			size_t image_id = load_image( path );
 			const image_info* image = get_image( image_id );
 			if ( image )
@@ -312,13 +311,13 @@
 		}
 
-		text = e->m_text;
-		if ( !text.empty() )
+		e->m_text;
+		if ( !e->m_text.empty() )
 		{
 			if ( m_style.get( e, "text_color", selector, color ) && m_style.get( e, "text_font", selector, path ) && m_style.get( e, "text_size", selector, border ) )
 			{
-				size_t font_id = load_font( string_view( path.c_str(), path.size() ), size_t( border ) );
+				size_t font_id = load_font( path, size_t( border ) );
 				texture_font* font = get_font( font_id );
 				position p = abs.ul + position( 0, border );
-				for ( char c : text )
+				for ( char c : e->m_text )
 				{
 					const texture_glyph* g = font->get_glyph( static_cast<uint16>( c ) );
Index: trunk/src/gui/gui_style.cc
===================================================================
--- trunk/src/gui/gui_style.cc	(revision 437)
+++ trunk/src/gui/gui_style.cc	(revision 440)
@@ -7,4 +7,5 @@
 #include "nv/gui/gui_style.hh"
 
+#include "nv/gui/gui_environment.hh"
 #include <nv/lua/lua_raw.hh>
 
@@ -12,25 +13,23 @@
 using namespace nv::gui;
 
-style::style()
-{
-}
-
 void style::load_style( const string_view& filename )
 {
+	NV_ASSERT_ALWAYS( m_env, "Environment not set in style!" );
 	m_lua.do_file( filename );
 }
 
-bool style::get( element* e, const char* centry, const char* cselector, std::string& s )
+bool style::get( element* e, const string_view& centry, const string_view& cselector, string128& s )
 {
 	lua::stack_guard guard( m_lua );
-	if ( !resolve( e->m_id.c_str(), e->m_class.c_str(), cselector, centry, LUA_TSTRING ) ) return false;
-	s = lua_tostring( m_lua, -1 );
+	if ( !resolve( e->m_id, e->m_class, cselector, centry, LUA_TSTRING ) ) return false;
+	// TODO: create lua_tostringbuffer< size >
+	s.assign( lua_tostring( m_lua, -1 ) );
 	return true;
 }
 
-bool style::get( element* e, const char* centry, const char* cselector, vec4& vec )
+bool style::get( element* e, const string_view& centry, const string_view& cselector, vec4& vec )
 {
 	lua::stack_guard guard( m_lua );
-	if ( !resolve( e->m_id.c_str(), e->m_class.c_str(), cselector, centry, LUA_TTABLE ) ) return false;
+	if ( !resolve( e->m_id, e->m_class, cselector, centry, LUA_TTABLE ) ) return false;
 	vec = vec4();
 	for ( int i = 0; i < 4; ++i )
@@ -44,16 +43,16 @@
 }
 
-bool style::get( element* e, const char* centry, const char* cselector, int& i )
+bool style::get( element* e, const string_view& centry, const string_view& cselector, int& i )
 {
 	lua::stack_guard guard( m_lua );
-	if ( !resolve( e->m_id.c_str(), e->m_class.c_str(), cselector, centry, LUA_TNUMBER ) ) return false;
+	if ( !resolve( e->m_id, e->m_class, cselector, centry, LUA_TNUMBER ) ) return false;
 	i = static_cast< int >( lua_tointeger( m_lua, -1 ) );
 	return true;
 }
 
-bool style::get( element* e, const char* centry, const char* cselector, double& d )
+bool style::get( element* e, const string_view& centry, const string_view& cselector, double& d )
 {
 	lua::stack_guard guard( m_lua );
-	if ( !resolve( e->m_id.c_str(), e->m_class.c_str(), cselector, centry, LUA_TNUMBER ) ) return false;
+	if ( !resolve( e->m_id, e->m_class, cselector, centry, LUA_TNUMBER ) ) return false;
 	d = lua_tonumber( m_lua, -1 );
 	return true;
@@ -64,14 +63,14 @@
 }
 
-bool style::find_entry( const char* cselector, const char* centry, int type )
+bool style::find_entry( const string_view& cselector, const string_view& centry, int type )
 {
 	if ( lua_istable( m_lua, -1 ) )
 	{
-		if ( cselector )
+		if ( !cselector.empty() )
 		{
-			lua_getfield( m_lua, -1, cselector );
+			lua_getfield( m_lua, -1, cselector.data() );
 			if ( lua_istable( m_lua, -1 ) )
 			{
-				lua_getfield( m_lua, -1, centry );
+				lua_getfield( m_lua, -1, centry.data() );
 				if ( lua_type( m_lua, -1 ) == type ) 
 				{
@@ -83,5 +82,5 @@
 		}
 
-		lua_getfield( m_lua, -1, centry );
+		lua_getfield( m_lua, -1, centry.data() );
 		if ( lua_type( m_lua, -1 ) == type ) return true;
 	}
@@ -89,5 +88,5 @@
 }
 
-bool style::resolve( const char* cid, const char* cclass, const char* cselector, const char* centry, int type )
+bool style::resolve( shash64 cid, shash64 cclass, const string_view& cselector, const string_view& centry, int type )
 {
 	lua_getglobal( m_lua, "default" );
@@ -95,12 +94,19 @@
 
 	// check id
-	lua_getfield( m_lua, -1, cid );
-	if ( find_entry( cselector, centry, type ) ) return true;
-	lua_settop( m_lua, global );
-
+	string_view id( m_env->get_string( cid ) );
+	if ( !id.empty() )
+	{
+		lua_getfield( m_lua, -1, id.data() );
+		if ( find_entry( cselector, centry, type ) ) return true;
+		lua_settop( m_lua, global );
+	}
 	// check class
-	lua_getfield( m_lua, -1, cclass );
-	if ( find_entry( cselector, centry, type ) ) return true;
-	lua_settop( m_lua, global );
+	string_view klass( m_env->get_string( cclass ) );
+	if ( !klass.empty() )
+	{
+		lua_getfield( m_lua, -1, klass.data() );
+		if ( find_entry( cselector, centry, type ) ) return true;
+		lua_settop( m_lua, global );
+	}
 
 	// check entry
