Restructuring rendering and some groundwork for tree model.