Convert 2 parameters to globals to reduce stack load in recursive function
Add feature to collapse attribute values so an approximate rendering can be done.