Reworked template restriction system.