Reworked template hierarchy