Move ENT_SUBSTITUTE to Template