rebuilt template hierarchy