From b93e4a1685b0beaed9387c376c3cb67af32fb621 Mon Sep 17 00:00:00 2001
From: Lars Johansson <lars.johansson@ess.eu>
Date: Tue, 26 Mar 2024 14:41:38 +0100
Subject: [PATCH] Remove non-audit table functionality

Major switch for functionality as non-audit related tables
no longer used for create, update, delete operations.

Focus on services.
Work in progress.

Note that commit is ninth step in introducing audit tables.
---
 .../repository/model/tmp/TmpDeviceGroup.java  |  14 +
 .../repository/model/tmp/TmpDeviceType.java   |  14 +
 .../repository/model/tmp/TmpDiscipline.java   |  13 +
 .../repository/model/tmp/TmpSubsystem.java    |  14 +
 .../names/repository/model/tmp/TmpSystem.java |  22 +-
 .../repository/model/tmp/TmpSystemGroup.java  |  18 +-
 .../tmp/ITmpDeviceGroupRepository.java        |   3 +
 .../tmp/ITmpDeviceTypeRepository.java         |   3 +
 .../repository/tmp/ITmpNameRepository.java    |  39 ++
 .../tmp/ITmpSubsystemRepository.java          |   3 +
 .../repository/tmp/ITmpSystemRepository.java  |   4 +-
 .../tmp/TmpAuditNameRepository.java           |   2 +-
 .../tmp/TmpDeviceGroupRepository.java         |   4 +-
 .../tmp/TmpDeviceTypeRepository.java          |   4 +-
 .../tmp/TmpDisciplineRepository.java          |   4 +-
 .../tmp/TmpSubsystemRepository.java           |   4 +-
 .../tmp/TmpSystemGroupRepository.java         |   4 +-
 .../repository/tmp/TmpSystemRepository.java   |   4 +-
 .../rest/controller/ReportController.java     |   2 +-
 .../names/service/DeviceGroupService.java     | 116 +----
 .../names/service/DeviceTypeService.java      | 105 +---
 .../names/service/DisciplineService.java      | 120 +----
 .../openepics/names/service/NamesService.java | 460 +++++-------------
 .../names/service/StructuresService.java      | 341 ++-----------
 .../names/service/SubsystemService.java       | 128 +----
 .../names/service/SystemGroupService.java     | 130 ++---
 .../names/service/SystemService.java          | 139 ++----
 .../openepics/names/util/NameElementUtil.java | 178 ++++++-
 .../org/openepics/names/util/NameUtil.java    |  75 ---
 .../names/util/StructureElementUtil.java      | 362 ++++++++++++++
 .../openepics/names/util/StructureUtil.java   |  75 ---
 .../notification/NotificationScheduler.java   |   4 +-
 .../names/util/NameElementUtilTest.java       |  33 +-
 .../openepics/names/util/NameUtilTest.java    |  57 +--
 34 files changed, 1032 insertions(+), 1466 deletions(-)

diff --git a/src/main/java/org/openepics/names/repository/model/tmp/TmpDeviceGroup.java b/src/main/java/org/openepics/names/repository/model/tmp/TmpDeviceGroup.java
index bb445bbb..4dd24d5f 100644
--- a/src/main/java/org/openepics/names/repository/model/tmp/TmpDeviceGroup.java
+++ b/src/main/java/org/openepics/names/repository/model/tmp/TmpDeviceGroup.java
@@ -81,6 +81,20 @@ public class TmpDeviceGroup extends TmpStructure {
         setParentId(parentId);
     }
 
+    /**
+     * Constructor for device group.
+     *
+     * @param tmpAuditStructure audit structure
+     */
+    public TmpDeviceGroup(TmpAuditStructure tmpAuditStructure) {
+        super(tmpAuditStructure.getUuid(),
+                tmpAuditStructure.getMnemonic(), tmpAuditStructure.getMnemonicEquivalence(), tmpAuditStructure.getOrdering(), tmpAuditStructure.getDescription(),
+                tmpAuditStructure.getStatus(), tmpAuditStructure.isDeleted(),
+                tmpAuditStructure.getProcessed(), tmpAuditStructure.getProcessedBy(), tmpAuditStructure.getProcessedComment());
+        setParentId(parentId);
+        this.id = tmpAuditStructure.getId();
+    }
+
     public Long getParentId() {
         return parentId;
     }
diff --git a/src/main/java/org/openepics/names/repository/model/tmp/TmpDeviceType.java b/src/main/java/org/openepics/names/repository/model/tmp/TmpDeviceType.java
index 0d643aae..e7a53841 100644
--- a/src/main/java/org/openepics/names/repository/model/tmp/TmpDeviceType.java
+++ b/src/main/java/org/openepics/names/repository/model/tmp/TmpDeviceType.java
@@ -81,6 +81,20 @@ public class TmpDeviceType extends TmpStructure {
         setParentId(parentId);
     }
 
+    /**
+     * Constructor for device type.
+     *
+     * @param tmpAuditStructure audit structure
+     */
+    public TmpDeviceType(TmpAuditStructure tmpAuditStructure) {
+        super(tmpAuditStructure.getUuid(),
+                tmpAuditStructure.getMnemonic(), tmpAuditStructure.getMnemonicEquivalence(), tmpAuditStructure.getOrdering(), tmpAuditStructure.getDescription(),
+                tmpAuditStructure.getStatus(), tmpAuditStructure.isDeleted(),
+                tmpAuditStructure.getProcessed(), tmpAuditStructure.getProcessedBy(), tmpAuditStructure.getProcessedComment());
+        setParentId(parentId);
+        this.id = tmpAuditStructure.getId();
+    }
+
     public Long getParentId() {
         return parentId;
     }
diff --git a/src/main/java/org/openepics/names/repository/model/tmp/TmpDiscipline.java b/src/main/java/org/openepics/names/repository/model/tmp/TmpDiscipline.java
index 440a052e..28664d2b 100644
--- a/src/main/java/org/openepics/names/repository/model/tmp/TmpDiscipline.java
+++ b/src/main/java/org/openepics/names/repository/model/tmp/TmpDiscipline.java
@@ -70,6 +70,19 @@ public class TmpDiscipline extends TmpStructure {
                 processed, processedBy, processedComment);
     }
 
+    /**
+     * Constructor for discipline.
+     *
+     * @param tmpAuditStructure audit structure
+     */
+    public TmpDiscipline(TmpAuditStructure tmpAuditStructure) {
+        super(tmpAuditStructure.getUuid(),
+                tmpAuditStructure.getMnemonic(), tmpAuditStructure.getMnemonicEquivalence(), tmpAuditStructure.getOrdering(), tmpAuditStructure.getDescription(),
+                tmpAuditStructure.getStatus(), tmpAuditStructure.isDeleted(),
+                tmpAuditStructure.getProcessed(), tmpAuditStructure.getProcessedBy(), tmpAuditStructure.getProcessedComment());
+        this.id = tmpAuditStructure.getId();
+    }
+
     @Override
     public boolean equals(Object obj) {
         if (this == obj)
diff --git a/src/main/java/org/openepics/names/repository/model/tmp/TmpSubsystem.java b/src/main/java/org/openepics/names/repository/model/tmp/TmpSubsystem.java
index 64041284..5f28a46c 100644
--- a/src/main/java/org/openepics/names/repository/model/tmp/TmpSubsystem.java
+++ b/src/main/java/org/openepics/names/repository/model/tmp/TmpSubsystem.java
@@ -81,6 +81,20 @@ public class TmpSubsystem extends TmpStructure {
         setParentId(parentId);
     }
 
+    /**
+     * Constructor for subsystem.
+     *
+     * @param tmpAuditStructure audit structure
+     */
+    public TmpSubsystem(TmpAuditStructure tmpAuditStructure) {
+        super(tmpAuditStructure.getUuid(),
+                tmpAuditStructure.getMnemonic(), tmpAuditStructure.getMnemonicEquivalence(), tmpAuditStructure.getOrdering(), tmpAuditStructure.getDescription(),
+                tmpAuditStructure.getStatus(), tmpAuditStructure.isDeleted(),
+                tmpAuditStructure.getProcessed(), tmpAuditStructure.getProcessedBy(), tmpAuditStructure.getProcessedComment());
+        setParentId(parentId);
+        this.id = tmpAuditStructure.getId();
+    }
+
     public Long getParentId() {
         return parentId;
     }
diff --git a/src/main/java/org/openepics/names/repository/model/tmp/TmpSystem.java b/src/main/java/org/openepics/names/repository/model/tmp/TmpSystem.java
index 812aaf83..a5393517 100644
--- a/src/main/java/org/openepics/names/repository/model/tmp/TmpSystem.java
+++ b/src/main/java/org/openepics/names/repository/model/tmp/TmpSystem.java
@@ -72,14 +72,30 @@ public class TmpSystem extends TmpStructure {
      * @param processedComment processed comment
      */
     public TmpSystem(UUID uuid, Long parentId,
-            String mnemonic, String mnemonicEquivalence, Integer ordering, String description, Status status, Boolean deleted,
+            String mnemonic, String mnemonicEquivalence, Integer ordering, String description,
+            Status status, Boolean deleted,
             Date processed, String processedBy, String processedComment) {
-        super(uuid, mnemonic, mnemonicEquivalence, ordering,
-                description, status, deleted,
+        super(uuid,
+                mnemonic, mnemonicEquivalence, ordering, description,
+                status, deleted,
                 processed, processedBy, processedComment);
         setParentId(parentId);
     }
 
+    /**
+     * Constructor for system.
+     *
+     * @param tmpAuditStructure audit structure
+     */
+    public TmpSystem(TmpAuditStructure tmpAuditStructure) {
+        super(tmpAuditStructure.getUuid(),
+                tmpAuditStructure.getMnemonic(), tmpAuditStructure.getMnemonicEquivalence(), tmpAuditStructure.getOrdering(), tmpAuditStructure.getDescription(),
+                tmpAuditStructure.getStatus(), tmpAuditStructure.isDeleted(),
+                tmpAuditStructure.getProcessed(), tmpAuditStructure.getProcessedBy(), tmpAuditStructure.getProcessedComment());
+        setParentId(parentId);
+        this.id = tmpAuditStructure.getId();
+    }
+
     public Long getParentId() {
         return parentId;
     }
diff --git a/src/main/java/org/openepics/names/repository/model/tmp/TmpSystemGroup.java b/src/main/java/org/openepics/names/repository/model/tmp/TmpSystemGroup.java
index ca23fd93..4540b7b8 100644
--- a/src/main/java/org/openepics/names/repository/model/tmp/TmpSystemGroup.java
+++ b/src/main/java/org/openepics/names/repository/model/tmp/TmpSystemGroup.java
@@ -65,11 +65,25 @@ public class TmpSystemGroup extends TmpStructure {
             String mnemonic, String mnemonicEquivalence, Integer ordering, String description,
             Status status, Boolean deleted,
             Date processed, String processedBy, String processedComment) {
-        super(uuid, mnemonic, mnemonicEquivalence, ordering,
-                description, status, deleted,
+        super(uuid,
+                mnemonic, mnemonicEquivalence, ordering, description,
+                status, deleted,
                 processed, processedBy, processedComment);
     }
 
+    /**
+     * Constructor for system group.
+     *
+     * @param tmpAuditStructure audit structure
+     */
+    public TmpSystemGroup(TmpAuditStructure tmpAuditStructure) {
+        super(tmpAuditStructure.getUuid(),
+                tmpAuditStructure.getMnemonic(), tmpAuditStructure.getMnemonicEquivalence(), tmpAuditStructure.getOrdering(), tmpAuditStructure.getDescription(),
+                tmpAuditStructure.getStatus(), tmpAuditStructure.isDeleted(),
+                tmpAuditStructure.getProcessed(), tmpAuditStructure.getProcessedBy(), tmpAuditStructure.getProcessedComment());
+        this.id = tmpAuditStructure.getId();
+    }
+
     @Override
     public boolean equals(Object obj) {
         if (this == obj)
diff --git a/src/main/java/org/openepics/names/repository/tmp/ITmpDeviceGroupRepository.java b/src/main/java/org/openepics/names/repository/tmp/ITmpDeviceGroupRepository.java
index 8bd764a0..63bd2392 100644
--- a/src/main/java/org/openepics/names/repository/tmp/ITmpDeviceGroupRepository.java
+++ b/src/main/java/org/openepics/names/repository/tmp/ITmpDeviceGroupRepository.java
@@ -39,4 +39,7 @@ public interface ITmpDeviceGroupRepository extends JpaRepository<TmpDeviceGroup,
     @Query("FROM TmpDeviceGroup dg WHERE dg.deleted = false")
     List<TmpDeviceGroup> findNotDeleted();
 
+    @Query("FROM TmpDeviceGroup dg WHERE dg.deleted = false AND dg.parentId = ?1")
+    List<TmpDeviceGroup> findNotDeletedByParent(Long id);
+
 }
diff --git a/src/main/java/org/openepics/names/repository/tmp/ITmpDeviceTypeRepository.java b/src/main/java/org/openepics/names/repository/tmp/ITmpDeviceTypeRepository.java
index 150dcb47..f58bc0a0 100644
--- a/src/main/java/org/openepics/names/repository/tmp/ITmpDeviceTypeRepository.java
+++ b/src/main/java/org/openepics/names/repository/tmp/ITmpDeviceTypeRepository.java
@@ -39,4 +39,7 @@ public interface ITmpDeviceTypeRepository extends JpaRepository<TmpDeviceType, L
     @Query("FROM TmpDeviceType dt WHERE dt.deleted = false")
     List<TmpDeviceType> findNotDeleted();
 
+    @Query("FROM TmpDeviceType dt WHERE dt.deleted = false AND dt.parentId = ?1")
+    List<TmpDeviceType> findNotDeletedByParent(Long id);
+
 }
diff --git a/src/main/java/org/openepics/names/repository/tmp/ITmpNameRepository.java b/src/main/java/org/openepics/names/repository/tmp/ITmpNameRepository.java
index bf34d210..8727a801 100644
--- a/src/main/java/org/openepics/names/repository/tmp/ITmpNameRepository.java
+++ b/src/main/java/org/openepics/names/repository/tmp/ITmpNameRepository.java
@@ -36,4 +36,43 @@ public interface ITmpNameRepository extends JpaRepository<TmpName, Long> {
     @Query("FROM TmpName n WHERE n.uuid = ?1")
     TmpName findByUuid(String uuid);
 
+    @Query("SELECT n FROM TmpName n, TmpSystemGroup sg "
+            + "WHERE n.deleted = false "
+            + "AND sg.id = n.systemGroupId "
+            + "AND sg.uuid = ?1")
+    List<TmpName> findNotDeletedBySystemGroupUuid(String uuid);
+
+    @Query("SELECT n FROM TmpName n, TmpSystem sys "
+            + "WHERE n.deleted = false "
+            + "AND sys.id = n.systemId "
+            + "AND sys.uuid = ?1")
+    List<TmpName> findNotDeletedBySystemUuid(String uuid);
+
+    @Query("SELECT n FROM TmpName n, TmpSubsystem sub, TmpSystem sys "
+            + "WHERE n.deleted = false "
+            + "AND sub.id = n.subsystemId "
+            + "AND sys.id = sub.parentId  "
+            + "AND sys.uuid = ?1")
+    List<TmpName> findNotDeletedBySystemUuidThroughSubsystem(String uuid);
+
+    @Query("SELECT n FROM TmpName n, TmpSubsystem sub "
+            + "WHERE n.deleted = false "
+            + "AND sub.id = n.subsystemId "
+            + "AND sub.uuid = ?1")
+    List<TmpName> findNotDeletedBySubsystemUuid(String uuid);
+
+    @Query("SELECT n FROM TmpName n, TmpDeviceType dt, TmpDeviceGroup dg, TmpDiscipline di "
+            + "WHERE n.deleted = false "
+            + "AND dt.id = n.deviceTypeId "
+            + "AND dg.id = dt.parentId "
+            + "AND di.id = dg.parentId "
+            + "AND di.uuid = ?1")
+    List<TmpName> findNotDeletedByDisciplineUuidThroughDeviceType(String uuid);
+
+    @Query("SELECT n FROM TmpName n, TmpDeviceType dt "
+            + "WHERE n.deleted = false "
+            + "AND dt.id = n.deviceTypeId "
+            + "AND dt.uuid = ?1")
+    List<TmpName> findNotDeletedByDeviceTypeUuid(String uuid);
+
 }
diff --git a/src/main/java/org/openepics/names/repository/tmp/ITmpSubsystemRepository.java b/src/main/java/org/openepics/names/repository/tmp/ITmpSubsystemRepository.java
index 1fdb72d1..37fe3814 100644
--- a/src/main/java/org/openepics/names/repository/tmp/ITmpSubsystemRepository.java
+++ b/src/main/java/org/openepics/names/repository/tmp/ITmpSubsystemRepository.java
@@ -39,4 +39,7 @@ public interface ITmpSubsystemRepository extends JpaRepository<TmpSubsystem, Lon
     @Query("FROM TmpSubsystem sub WHERE sub.deleted = false")
     List<TmpSubsystem> findNotDeleted();
 
+    @Query("FROM TmpSubsystem sub WHERE sub.deleted = false AND sub.parentId = ?1")
+    List<TmpSubsystem> findNotDeletedByParent(Long id);
+
 }
diff --git a/src/main/java/org/openepics/names/repository/tmp/ITmpSystemRepository.java b/src/main/java/org/openepics/names/repository/tmp/ITmpSystemRepository.java
index 61e48db7..2e36f23f 100644
--- a/src/main/java/org/openepics/names/repository/tmp/ITmpSystemRepository.java
+++ b/src/main/java/org/openepics/names/repository/tmp/ITmpSystemRepository.java
@@ -39,8 +39,10 @@ public interface ITmpSystemRepository extends JpaRepository<TmpSystem, Long> {
     @Query("FROM TmpSystem sys WHERE sys.deleted = false AND sys.mnemonic = ?1")
     TmpSystem findNotDeletedByMnemonic(String mnemonic);
 
-
     @Query("FROM TmpSystem sys WHERE sys.deleted = false")
     List<TmpSystem> findNotDeleted();
 
+    @Query("FROM TmpSystem sys WHERE sys.deleted = false AND sys.parentId = ?1")
+    List<TmpSystem> findNotDeletedByParent(Long id);
+
 }
diff --git a/src/main/java/org/openepics/names/repository/tmp/TmpAuditNameRepository.java b/src/main/java/org/openepics/names/repository/tmp/TmpAuditNameRepository.java
index 099f6869..64bd29c1 100644
--- a/src/main/java/org/openepics/names/repository/tmp/TmpAuditNameRepository.java
+++ b/src/main/java/org/openepics/names/repository/tmp/TmpAuditNameRepository.java
@@ -91,7 +91,7 @@ public class TmpAuditNameRepository {
                 uuid).toArray(new Predicate[0])));
         cq.select(from);
 
-        cq.orderBy(cb.asc(from.get(TmpNameStructure.FIELD_PROCESSED)));
+        cq.orderBy(cb.asc(from.get(TmpNameStructure.FIELD_REQUESTED)));
 
         TypedQuery<TmpAuditName> query = em.createQuery(cq);
         if (offset != null && limit != null) {
diff --git a/src/main/java/org/openepics/names/repository/tmp/TmpDeviceGroupRepository.java b/src/main/java/org/openepics/names/repository/tmp/TmpDeviceGroupRepository.java
index b032d887..64c8fc2a 100644
--- a/src/main/java/org/openepics/names/repository/tmp/TmpDeviceGroupRepository.java
+++ b/src/main/java/org/openepics/names/repository/tmp/TmpDeviceGroupRepository.java
@@ -210,7 +210,7 @@ public class TmpDeviceGroupRepository {
             predicates.add(cb.and(cb.like(from.get(TmpNameStructure.FIELD_DESCRIPTION), RepositoryUtil.preparePattern(description))));
         }
         if (!StringUtils.isEmpty(who)) {
-            predicates.add(cb.and(cb.like(from.get(TmpNameStructure.FIELD_REQUESTED_BY), RepositoryUtil.preparePattern(who))));
+            predicates.add(cb.and(cb.like(from.get(TmpNameStructure.FIELD_PROCESSED_BY), RepositoryUtil.preparePattern(who))));
         }
 
         return predicates;
@@ -237,7 +237,7 @@ public class TmpDeviceGroupRepository {
         } else if (FieldStructure.DESCRIPTION.equals(orderBy)) {
             return root.get(TmpNameStructure.FIELD_DESCRIPTION);
         } else if (FieldStructure.WHEN.equals(orderBy)) {
-            return root.get(TmpNameStructure.FIELD_REQUESTED);
+            return root.get(TmpNameStructure.FIELD_PROCESSED);
         } else {
             return root.get(TmpStructure.FIELD_MNEMONIC);
         }
diff --git a/src/main/java/org/openepics/names/repository/tmp/TmpDeviceTypeRepository.java b/src/main/java/org/openepics/names/repository/tmp/TmpDeviceTypeRepository.java
index f4f18be6..e8c73305 100644
--- a/src/main/java/org/openepics/names/repository/tmp/TmpDeviceTypeRepository.java
+++ b/src/main/java/org/openepics/names/repository/tmp/TmpDeviceTypeRepository.java
@@ -210,7 +210,7 @@ public class TmpDeviceTypeRepository {
             predicates.add(cb.and(cb.like(from.get(TmpNameStructure.FIELD_DESCRIPTION), RepositoryUtil.preparePattern(description))));
         }
         if (!StringUtils.isEmpty(who)) {
-            predicates.add(cb.and(cb.like(from.get(TmpNameStructure.FIELD_REQUESTED_BY), RepositoryUtil.preparePattern(who))));
+            predicates.add(cb.and(cb.like(from.get(TmpNameStructure.FIELD_PROCESSED_BY), RepositoryUtil.preparePattern(who))));
         }
 
         return predicates;
@@ -237,7 +237,7 @@ public class TmpDeviceTypeRepository {
         } else if (FieldStructure.DESCRIPTION.equals(orderBy)) {
             return root.get(TmpNameStructure.FIELD_DESCRIPTION);
         } else if (FieldStructure.WHEN.equals(orderBy)) {
-            return root.get(TmpNameStructure.FIELD_REQUESTED);
+            return root.get(TmpNameStructure.FIELD_PROCESSED);
         } else {
             return root.get(TmpStructure.FIELD_MNEMONIC);
         }
diff --git a/src/main/java/org/openepics/names/repository/tmp/TmpDisciplineRepository.java b/src/main/java/org/openepics/names/repository/tmp/TmpDisciplineRepository.java
index d0f2f31f..a6a9ee30 100644
--- a/src/main/java/org/openepics/names/repository/tmp/TmpDisciplineRepository.java
+++ b/src/main/java/org/openepics/names/repository/tmp/TmpDisciplineRepository.java
@@ -202,7 +202,7 @@ public class TmpDisciplineRepository {
             predicates.add(cb.and(cb.like(from.get(TmpNameStructure.FIELD_DESCRIPTION), RepositoryUtil.preparePattern(description))));
         }
         if (!StringUtils.isEmpty(who)) {
-            predicates.add(cb.and(cb.like(from.get(TmpNameStructure.FIELD_REQUESTED_BY), RepositoryUtil.preparePattern(who))));
+            predicates.add(cb.and(cb.like(from.get(TmpNameStructure.FIELD_PROCESSED_BY), RepositoryUtil.preparePattern(who))));
         }
 
         return predicates;
@@ -229,7 +229,7 @@ public class TmpDisciplineRepository {
         } else if (FieldStructure.DESCRIPTION.equals(orderBy)) {
             return root.get(TmpNameStructure.FIELD_DESCRIPTION);
         } else if (FieldStructure.WHEN.equals(orderBy)) {
-            return root.get(TmpNameStructure.FIELD_REQUESTED);
+            return root.get(TmpNameStructure.FIELD_PROCESSED);
         } else {
             return root.get(TmpStructure.FIELD_MNEMONIC);
         }
diff --git a/src/main/java/org/openepics/names/repository/tmp/TmpSubsystemRepository.java b/src/main/java/org/openepics/names/repository/tmp/TmpSubsystemRepository.java
index 521e5377..bf46fbe4 100644
--- a/src/main/java/org/openepics/names/repository/tmp/TmpSubsystemRepository.java
+++ b/src/main/java/org/openepics/names/repository/tmp/TmpSubsystemRepository.java
@@ -210,7 +210,7 @@ public class TmpSubsystemRepository {
             predicates.add(cb.and(cb.like(from.get(TmpNameStructure.FIELD_DESCRIPTION), RepositoryUtil.preparePattern(description))));
         }
         if (!StringUtils.isEmpty(who)) {
-            predicates.add(cb.and(cb.like(from.get(TmpNameStructure.FIELD_REQUESTED_BY), RepositoryUtil.preparePattern(who))));
+            predicates.add(cb.and(cb.like(from.get(TmpNameStructure.FIELD_PROCESSED_BY), RepositoryUtil.preparePattern(who))));
         }
 
         return predicates;
@@ -237,7 +237,7 @@ public class TmpSubsystemRepository {
         } else if (FieldStructure.DESCRIPTION.equals(orderBy)) {
             return root.get(TmpNameStructure.FIELD_DESCRIPTION);
         } else if (FieldStructure.WHEN.equals(orderBy)) {
-            return root.get(TmpNameStructure.FIELD_REQUESTED);
+            return root.get(TmpNameStructure.FIELD_PROCESSED);
         } else {
             return root.get(TmpStructure.FIELD_MNEMONIC);
         }
diff --git a/src/main/java/org/openepics/names/repository/tmp/TmpSystemGroupRepository.java b/src/main/java/org/openepics/names/repository/tmp/TmpSystemGroupRepository.java
index 63b3a61a..4140a318 100644
--- a/src/main/java/org/openepics/names/repository/tmp/TmpSystemGroupRepository.java
+++ b/src/main/java/org/openepics/names/repository/tmp/TmpSystemGroupRepository.java
@@ -198,7 +198,7 @@ public class TmpSystemGroupRepository {
             predicates.add(cb.and(cb.like(from.get(TmpNameStructure.FIELD_DESCRIPTION), RepositoryUtil.preparePattern(description))));
         }
         if (!StringUtils.isEmpty(who)) {
-            predicates.add(cb.and(cb.like(from.get(TmpNameStructure.FIELD_REQUESTED_BY), RepositoryUtil.preparePattern(who))));
+            predicates.add(cb.and(cb.like(from.get(TmpNameStructure.FIELD_PROCESSED_BY), RepositoryUtil.preparePattern(who))));
         }
 
         return predicates;
@@ -225,7 +225,7 @@ public class TmpSystemGroupRepository {
         } else if (FieldStructure.DESCRIPTION.equals(orderBy)) {
             return root.get(TmpNameStructure.FIELD_DESCRIPTION);
         } else if (FieldStructure.WHEN.equals(orderBy)) {
-            return root.get(TmpNameStructure.FIELD_REQUESTED);
+            return root.get(TmpNameStructure.FIELD_PROCESSED);
         } else {
             return root.get(TmpStructure.FIELD_MNEMONIC);
         }
diff --git a/src/main/java/org/openepics/names/repository/tmp/TmpSystemRepository.java b/src/main/java/org/openepics/names/repository/tmp/TmpSystemRepository.java
index baf6bad3..ed68bbd4 100644
--- a/src/main/java/org/openepics/names/repository/tmp/TmpSystemRepository.java
+++ b/src/main/java/org/openepics/names/repository/tmp/TmpSystemRepository.java
@@ -210,7 +210,7 @@ public class TmpSystemRepository {
             predicates.add(cb.and(cb.like(from.get(TmpNameStructure.FIELD_DESCRIPTION), RepositoryUtil.preparePattern(description))));
         }
         if (!StringUtils.isEmpty(who)) {
-            predicates.add(cb.and(cb.like(from.get(TmpNameStructure.FIELD_REQUESTED_BY), RepositoryUtil.preparePattern(who))));
+            predicates.add(cb.and(cb.like(from.get(TmpNameStructure.FIELD_PROCESSED_BY), RepositoryUtil.preparePattern(who))));
         }
 
         return predicates;
@@ -237,7 +237,7 @@ public class TmpSystemRepository {
         } else if (FieldStructure.DESCRIPTION.equals(orderBy)) {
             return root.get(TmpNameStructure.FIELD_DESCRIPTION);
         } else if (FieldStructure.WHEN.equals(orderBy)) {
-            return root.get(TmpNameStructure.FIELD_REQUESTED);
+            return root.get(TmpNameStructure.FIELD_PROCESSED);
         } else {
             return root.get(TmpStructure.FIELD_MNEMONIC);
         }
diff --git a/src/main/java/org/openepics/names/rest/controller/ReportController.java b/src/main/java/org/openepics/names/rest/controller/ReportController.java
index ebc3aae0..1e8835e8 100644
--- a/src/main/java/org/openepics/names/rest/controller/ReportController.java
+++ b/src/main/java/org/openepics/names/rest/controller/ReportController.java
@@ -283,7 +283,7 @@ public class ReportController {
         .append(DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL).format(new Date())).append(NEWLINE)
         .append(DIVIDER_128).append(NEWLINE)
         .append("Name and structure data are displayed per line of uuid which is unique identifier through lifecycle of entry.").append(NEWLINE)
-        .append("Note # means number of, active means approved valid not deleted, obsolete values are not shown unless history is requested.").append(NEWLINE)
+        .append("Note # means number of, active means valid not deleted, obsolete values are not shown unless history is requested.").append(NEWLINE)
         .append(DIVIDER_128).append(NEWLINE)
         .append("Metrics for Naming").append(NEWLINE)
         .append("    1) # entries - Overview").append(NEWLINE)
diff --git a/src/main/java/org/openepics/names/service/DeviceGroupService.java b/src/main/java/org/openepics/names/service/DeviceGroupService.java
index ebc44167..4aaaaf3e 100644
--- a/src/main/java/org/openepics/names/service/DeviceGroupService.java
+++ b/src/main/java/org/openepics/names/service/DeviceGroupService.java
@@ -26,16 +26,13 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.apache.commons.lang3.StringUtils;
-import org.openepics.names.repository.DeviceGroupRepository;
-import org.openepics.names.repository.IDeviceGroupRepository;
-import org.openepics.names.repository.IDeviceTypeRepository;
-import org.openepics.names.repository.model.DeviceGroup;
-import org.openepics.names.repository.model.DeviceType;
 import org.openepics.names.repository.model.tmp.TmpAuditStructure;
 import org.openepics.names.repository.model.tmp.TmpDeviceGroup;
+import org.openepics.names.repository.model.tmp.TmpDeviceType;
 import org.openepics.names.repository.model.tmp.TmpDiscipline;
 import org.openepics.names.repository.tmp.ITmpAuditStructureRepository;
 import org.openepics.names.repository.tmp.ITmpDeviceGroupRepository;
+import org.openepics.names.repository.tmp.ITmpDeviceTypeRepository;
 import org.openepics.names.repository.tmp.ITmpDisciplineRepository;
 import org.openepics.names.repository.tmp.TmpAuditStructureRepository;
 import org.openepics.names.repository.tmp.TmpDeviceGroupRepository;
@@ -43,14 +40,11 @@ import org.openepics.names.rest.beans.Status;
 import org.openepics.names.rest.beans.Type;
 import org.openepics.names.rest.beans.element.StructureElementCommand;
 import org.openepics.names.util.EssNamingConvention;
-import org.openepics.names.util.HolderStructures;
 import org.openepics.names.util.HolderTmpStructures;
 import org.openepics.names.util.StructureChoice;
 import org.openepics.names.util.StructureCommand;
 import org.openepics.names.util.StructureElementUtil;
-import org.openepics.names.util.StructureUtil;
 import org.openepics.names.util.TextUtil;
-import org.openepics.names.util.ValidateUtil;
 import org.openepics.names.util.notification.NotificationUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -70,11 +64,9 @@ public class DeviceGroupService {
     private static final Logger LOGGER = Logger.getLogger(DeviceGroupService.class.getName());
 
     private DeviceTypeService deviceTypeService;
-    private IDeviceGroupRepository iDeviceGroupRepository;
-    private IDeviceTypeRepository iDeviceTypeRepository;
-    private DeviceGroupRepository deviceGroupRepository;
     private ITmpDisciplineRepository iTmpDisciplineRepository;
     private ITmpDeviceGroupRepository iTmpDeviceGroupRepository;
+    private ITmpDeviceTypeRepository iTmpDeviceTypeRepository;
     private ITmpAuditStructureRepository iTmpAuditStructureRepository;
     private TmpDeviceGroupRepository tmpDeviceGroupRepository;
     private TmpAuditStructureRepository tmpAuditStructureRepository;
@@ -82,20 +74,16 @@ public class DeviceGroupService {
     @Autowired
     public DeviceGroupService(
             DeviceTypeService deviceTypeService,
-            IDeviceGroupRepository iDeviceGroupRepository,
-            IDeviceTypeRepository iDeviceTypeRepository,
-            DeviceGroupRepository deviceGroupRepository,
             ITmpDisciplineRepository iTmpDisciplineRepository,
             ITmpDeviceGroupRepository iTmpDeviceGroupRepository,
+            ITmpDeviceTypeRepository iTmpDeviceTypeRepository,
             ITmpAuditStructureRepository iTmpAuditStructureRepository,
             TmpDeviceGroupRepository tmpDeviceGroupRepository,
             TmpAuditStructureRepository tmpAuditStructureRepository) {
         this.deviceTypeService = deviceTypeService;
-        this.iDeviceGroupRepository = iDeviceGroupRepository;
-        this.iDeviceTypeRepository = iDeviceTypeRepository;
-        this.deviceGroupRepository = deviceGroupRepository;
         this.iTmpDisciplineRepository = iTmpDisciplineRepository;
         this.iTmpDeviceGroupRepository = iTmpDeviceGroupRepository;
+        this.iTmpDeviceTypeRepository  = iTmpDeviceTypeRepository;
         this.iTmpAuditStructureRepository = iTmpAuditStructureRepository;
         this.tmpDeviceGroupRepository = tmpDeviceGroupRepository;
         this.tmpAuditStructureRepository = tmpAuditStructureRepository;
@@ -103,12 +91,13 @@ public class DeviceGroupService {
 
     @Transactional(propagation = Propagation.MANDATORY)
     public StructureElementNotification createStructure(StructureElementCommand structureElementCommand, Date when, String username,
-            EssNamingConvention namingConvention, HolderStructures holderStructures, HolderTmpStructures holderTmpStructures) {
+            EssNamingConvention namingConvention, HolderTmpStructures holderTmpStructures) {
 
         // validation outside method
         // transaction
         //     support a current transaction, throw an exception if none exists
-        //     create structure - approved, latest, not deleted
+        //     create structure
+        //     create audit
         //     return
         //         structure element for created structure
         //         notification
@@ -118,16 +107,8 @@ public class DeviceGroupService {
         mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic;
         String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic);
 
-        // create
-        DeviceGroup deviceGroup = new DeviceGroup(uuid, structureElementCommand.getParent(),
-                mnemonic, equivalenceClassRepresentative, structureElementCommand.getOrdering(),
-                structureElementCommand.getDescription(), Status.APPROVED, Boolean.TRUE, Boolean.FALSE,
-                when, username, null);
-        deviceGroupRepository.createDeviceGroup(deviceGroup);
-
-        // create tmp
+        // create structure
         // create audit
-        // <TMP>
         TmpDiscipline tmpDiscipline = iTmpDisciplineRepository.findByUuid(structureElementCommand.getParent().toString());
         TmpDeviceGroup tmpDeviceGroup = new TmpDeviceGroup(uuid, tmpDiscipline.getId(),
                 mnemonic, equivalenceClassRepresentative, structureElementCommand.getOrdering(),
@@ -135,24 +116,23 @@ public class DeviceGroupService {
                 when, username, null);
         tmpDeviceGroupRepository.createDeviceGroup(tmpDeviceGroup);
         tmpAuditStructureRepository.createTmpAuditStructure(new TmpAuditStructure(TextUtil.CREATE, tmpDeviceGroup));
-        // </TMP>
 
         LOGGER.log(Level.FINE, () -> MessageFormat.format(TextUtil.DESCRIPTION_NAME_VALUE, TextUtil.CREATE_STRUCTURE, TextUtil.COMMAND, StructureCommand.CREATE));
 
         return new StructureElementNotification(
-                StructureElementUtil.getStructureElementProcessed(deviceGroup, holderStructures, StructureChoice.STRUCTURE),
+                StructureElementUtil.getStructureElementProcessed(tmpDeviceGroup, holderTmpStructures, StructureChoice.STRUCTURE),
                 NotificationUtil.prepareNotification(Type.DEVICEGROUP, StructureCommand.CREATE, null, tmpDeviceGroup, holderTmpStructures));
     }
 
     @Transactional(propagation = Propagation.MANDATORY)
     public StructureElementNotification updateStructure(StructureElementCommand structureElementCommand, Date when, String username,
-            EssNamingConvention namingConvention, HolderStructures holderStructures, HolderTmpStructures holderTmpStructures) {
+            EssNamingConvention namingConvention, HolderTmpStructures holderTmpStructures) {
 
         // validation outside method
         // transaction
         //     support a current transaction, throw an exception if none exists
-        //     update structure - not latest
-        //     create structure - approved, latest, not deleted
+        //     update structure
+        //     create audit
         //     previous for notification
         //     return
         //         structure element for updated structure
@@ -163,25 +143,8 @@ public class DeviceGroupService {
         mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic;
         String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic);
 
-        // update
-        List<DeviceGroup> deviceGroups = deviceGroupRepository.readDeviceGroups(Boolean.FALSE, uuid, null, null, null, null, null, null);
-        DeviceGroup deviceGroup = null;
-        if (ValidateUtil.isSize(deviceGroups, 1)) {
-            deviceGroup = deviceGroups.get(0);
-            deviceGroup.setLatest(Boolean.FALSE);
-            deviceGroupRepository.updateDeviceGroup(deviceGroup);
-        }
-
-        // create
-        deviceGroup = new DeviceGroup(structureElementCommand.getUuid(), structureElementCommand.getParent(),
-                mnemonic, equivalenceClassRepresentative, structureElementCommand.getOrdering(),
-                structureElementCommand.getDescription(), Status.APPROVED, Boolean.TRUE, Boolean.FALSE,
-                when, username, null);
-        deviceGroupRepository.createDeviceGroup(deviceGroup);
-
-        // update tmp
+        // update structure
         // create audit
-        // <TMP>
         TmpDeviceGroup tmpDeviceGroup = iTmpDeviceGroupRepository.findByUuid(uuid);
         tmpDeviceGroup.setMnemonic(mnemonic);
         tmpDeviceGroup.setMnemonicEquivalence(equivalenceClassRepresentative);
@@ -190,32 +153,27 @@ public class DeviceGroupService {
         tmpDeviceGroupRepository.updateDeviceGroup(tmpDeviceGroup);
         TmpAuditStructure tmpAuditStructure = new TmpAuditStructure(TextUtil.UPDATE, tmpDeviceGroup);
         tmpAuditStructureRepository.createTmpAuditStructure(tmpAuditStructure);
-        // </TMP>
 
         // previous
-        List<DeviceGroup> previouses = iDeviceGroupRepository.findPreviousByUuidAndId(deviceGroup.getUuid().toString(), deviceGroup.getId());
-        DeviceGroup previous = previouses != null && !previouses.isEmpty() ? previouses.get(0) : null;
-        // <TMP>
         TmpAuditStructure tmpPreviousAuditStructure = iTmpAuditStructureRepository.findPreviousByAuditTableAndUuidAndAuditId(Type.DEVICEGROUP.name().toLowerCase(), uuid, tmpAuditStructure.getAuditId());
-        TmpDeviceGroup tmpPrevious = StructureUtil.convert2DeviceGroup(tmpPreviousAuditStructure);
-        // </TMP>
+        TmpDeviceGroup tmpPrevious = new TmpDeviceGroup(tmpPreviousAuditStructure);
 
         LOGGER.log(Level.FINE, () -> MessageFormat.format(TextUtil.DESCRIPTION_NAME_VALUE, TextUtil.UPDATE_STRUCTURE, TextUtil.COMMAND, StructureCommand.UPDATE));
 
         return new StructureElementNotification(
-                StructureElementUtil.getStructureElementProcessed(deviceGroup, holderStructures, StructureChoice.STRUCTURE),
+                StructureElementUtil.getStructureElementProcessed(tmpDeviceGroup, holderTmpStructures, StructureChoice.STRUCTURE),
                 NotificationUtil.prepareNotification(Type.DEVICEGROUP, StructureCommand.UPDATE, tmpPrevious, tmpDeviceGroup, holderTmpStructures));
     }
 
     @Transactional(propagation = Propagation.MANDATORY)
     public StructureElementNotification deleteStructure(StructureElementCommand structureElementCommand, Date when, String username,
-            HolderStructures holderStructures, HolderTmpStructures holderTmpStructures) {
+            HolderTmpStructures holderTmpStructures) {
 
         // validation outside method
         // transaction
         //     support a current transaction, throw an exception if none exists
-        //     update structure - not latest
-        //     create structure - approved, latest, deleted
+        //     delete structure (update)
+        //     create audit
         //     previous for notification
         //     additional
         //         delete sub structures (and related names)
@@ -225,58 +183,34 @@ public class DeviceGroupService {
 
         String uuid = structureElementCommand.getUuid().toString();
 
-        // update
-        List<DeviceGroup> deviceGroups = deviceGroupRepository.readDeviceGroups(Boolean.FALSE, uuid, null, null, null, null, null, null);
-        DeviceGroup deviceGroup = null;
-        if (ValidateUtil.isSize(deviceGroups, 1)) {
-            deviceGroup = deviceGroups.get(0);
-            deviceGroup.setLatest(Boolean.FALSE);
-            deviceGroupRepository.updateDeviceGroup(deviceGroup);
-        } else {
-            return null;
-        }
-
-        // create
-        deviceGroup = new DeviceGroup(deviceGroup.getUuid(), deviceGroup.getParentUuid(),
-                deviceGroup.getMnemonic(), deviceGroup.getMnemonicEquivalence(), deviceGroup.getOrdering(),
-                deviceGroup.getDescription(), Status.APPROVED, Boolean.TRUE, Boolean.TRUE,
-                when, username, null);
-        deviceGroupRepository.createDeviceGroup(deviceGroup);
-
-        // update tmp
+        // delete structure
         // create audit
-        // <TMP>
         TmpDeviceGroup tmpDeviceGroup = iTmpDeviceGroupRepository.findByUuid(uuid);
         tmpDeviceGroup.setDeleted(Boolean.TRUE);
         tmpDeviceGroup.setAttributesProcessed(when, username, null);
         tmpDeviceGroupRepository.updateDeviceGroup(tmpDeviceGroup);
         TmpAuditStructure tmpAuditStructure = new TmpAuditStructure(TextUtil.DELETE, tmpDeviceGroup);
         tmpAuditStructureRepository.createTmpAuditStructure(tmpAuditStructure);
-        // </TMP>
 
         // previous
-        List<DeviceGroup> previouses = iDeviceGroupRepository.findPreviousByUuidAndId(uuid, deviceGroup.getId());
-        DeviceGroup previous = previouses != null && !previouses.isEmpty() ? previouses.get(0) : null;
-        // <TMP>
         TmpAuditStructure tmpPreviousAuditStructure = iTmpAuditStructureRepository.findPreviousByAuditTableAndUuidAndAuditId(Type.DEVICEGROUP.name().toLowerCase(), uuid, tmpAuditStructure.getAuditId());
-        TmpDeviceGroup tmpPrevious = StructureUtil.convert2DeviceGroup(tmpPreviousAuditStructure);
-        // </TMP>
+        TmpDeviceGroup tmpPrevious = new TmpDeviceGroup(tmpPreviousAuditStructure);
 
         // additional
         //     will propagate to sub structures
         List<StructureElementCommand> commands = Lists.newArrayList();
-        List<DeviceType> deviceTypes = iDeviceTypeRepository.findLatestNotDeletedByParent(uuid);
-        for (DeviceType deviceType : deviceTypes) {
+        List<TmpDeviceType> deviceTypes = iTmpDeviceTypeRepository.findNotDeletedByParent(tmpDeviceGroup.getId());
+        for (TmpDeviceType deviceType : deviceTypes) {
             commands.add(new StructureElementCommand(deviceType.getUuid(), Type.DEVICETYPE, null, null, null, null));
         }
         for (StructureElementCommand command : commands) {
-            deviceTypeService.deleteStructure(command, when, username, holderStructures, holderTmpStructures);
+            deviceTypeService.deleteStructure(command, when, username, holderTmpStructures);
         }
 
         LOGGER.log(Level.FINE, () -> MessageFormat.format(TextUtil.DESCRIPTION_NAME_VALUE, TextUtil.DELETE_STRUCTURE, TextUtil.COMMAND, StructureCommand.DELETE));
 
         return new StructureElementNotification(
-                StructureElementUtil.getStructureElementProcessed(deviceGroup, holderStructures, StructureChoice.STRUCTURE),
+                StructureElementUtil.getStructureElementProcessed(tmpDeviceGroup, holderTmpStructures, StructureChoice.STRUCTURE),
                 NotificationUtil.prepareNotification(Type.DEVICEGROUP, StructureCommand.DELETE, tmpPrevious, tmpDeviceGroup, holderTmpStructures));
     }
 
diff --git a/src/main/java/org/openepics/names/service/DeviceTypeService.java b/src/main/java/org/openepics/names/service/DeviceTypeService.java
index ff55ffb4..ff49f994 100644
--- a/src/main/java/org/openepics/names/service/DeviceTypeService.java
+++ b/src/main/java/org/openepics/names/service/DeviceTypeService.java
@@ -20,15 +20,11 @@ package org.openepics.names.service;
 
 import java.text.MessageFormat;
 import java.util.Date;
-import java.util.List;
 import java.util.UUID;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.apache.commons.lang3.StringUtils;
-import org.openepics.names.repository.DeviceTypeRepository;
-import org.openepics.names.repository.IDeviceTypeRepository;
-import org.openepics.names.repository.model.DeviceType;
 import org.openepics.names.repository.model.tmp.TmpAuditStructure;
 import org.openepics.names.repository.model.tmp.TmpDeviceGroup;
 import org.openepics.names.repository.model.tmp.TmpDeviceType;
@@ -41,14 +37,11 @@ import org.openepics.names.rest.beans.Status;
 import org.openepics.names.rest.beans.Type;
 import org.openepics.names.rest.beans.element.StructureElementCommand;
 import org.openepics.names.util.EssNamingConvention;
-import org.openepics.names.util.HolderStructures;
 import org.openepics.names.util.HolderTmpStructures;
 import org.openepics.names.util.StructureChoice;
 import org.openepics.names.util.StructureCommand;
 import org.openepics.names.util.StructureElementUtil;
-import org.openepics.names.util.StructureUtil;
 import org.openepics.names.util.TextUtil;
-import org.openepics.names.util.ValidateUtil;
 import org.openepics.names.util.notification.NotificationUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -66,8 +59,6 @@ public class DeviceTypeService {
     private static final Logger LOGGER = Logger.getLogger(DeviceTypeService.class.getName());
 
     private NamesService namesService;
-    private IDeviceTypeRepository iDeviceTypeRepository;
-    private DeviceTypeRepository deviceTypeRepository;
     private ITmpDeviceGroupRepository iTmpDeviceGroupRepository;
     private ITmpDeviceTypeRepository iTmpDeviceTypeRepository;
     private ITmpAuditStructureRepository iTmpAuditStructureRepository;
@@ -77,16 +68,12 @@ public class DeviceTypeService {
     @Autowired
     public DeviceTypeService(
             NamesService namesService,
-            IDeviceTypeRepository iDeviceTypeRepository,
-            DeviceTypeRepository deviceTypeRepository,
             ITmpDeviceGroupRepository iTmpDeviceGroupRepository,
             ITmpDeviceTypeRepository iTmpDeviceTypeRepository,
             ITmpAuditStructureRepository iTmpAuditStructureRepository,
             TmpDeviceTypeRepository tmpDeviceTypeRepository,
             TmpAuditStructureRepository tmpAuditStructureRepository) {
         this.namesService = namesService;
-        this.iDeviceTypeRepository = iDeviceTypeRepository;
-        this.deviceTypeRepository = deviceTypeRepository;
         this.iTmpDeviceGroupRepository = iTmpDeviceGroupRepository;
         this.iTmpDeviceTypeRepository = iTmpDeviceTypeRepository;
         this.iTmpAuditStructureRepository = iTmpAuditStructureRepository;
@@ -96,12 +83,13 @@ public class DeviceTypeService {
 
     @Transactional(propagation = Propagation.MANDATORY)
     public StructureElementNotification createStructure(StructureElementCommand structureElementCommand, Date when, String username,
-            EssNamingConvention namingConvention, HolderStructures holderStructures, HolderTmpStructures holderTmpStructures) {
+            EssNamingConvention namingConvention, HolderTmpStructures holderTmpStructures) {
 
         // validation outside method
         // transaction
         //     support a current transaction, throw an exception if none exists
-        //     create structure - approved, latest, not deleted
+        //     create structure
+        //     create audit
         //     return
         //         structure element for created structure
         //         notification
@@ -111,16 +99,8 @@ public class DeviceTypeService {
         mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic;
         String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic);
 
-        // create
-        DeviceType deviceType = new DeviceType(uuid, structureElementCommand.getParent(),
-                mnemonic, equivalenceClassRepresentative, structureElementCommand.getOrdering(),
-                structureElementCommand.getDescription(), Status.APPROVED, Boolean.TRUE, Boolean.FALSE,
-                when, username, null);
-        deviceTypeRepository.createDeviceType(deviceType);
-
-        // create tmp
+        // create structure
         // create audit
-        // <TMP>
         TmpDeviceGroup tmpDeviceGroup = iTmpDeviceGroupRepository.findByUuid(structureElementCommand.getParent().toString());
         TmpDeviceType tmpDeviceType = new TmpDeviceType(uuid, tmpDeviceGroup.getId(),
                 mnemonic, equivalenceClassRepresentative, structureElementCommand.getOrdering(),
@@ -128,24 +108,23 @@ public class DeviceTypeService {
                 when, username, null);
         tmpDeviceTypeRepository.createDeviceType(tmpDeviceType);
         tmpAuditStructureRepository.createTmpAuditStructure(new TmpAuditStructure(TextUtil.CREATE, tmpDeviceType));
-        // </TMP>
 
         LOGGER.log(Level.FINE, () -> MessageFormat.format(TextUtil.DESCRIPTION_NAME_VALUE, TextUtil.CREATE_STRUCTURE, TextUtil.COMMAND, StructureCommand.CREATE));
 
         return new StructureElementNotification(
-                StructureElementUtil.getStructureElementProcessed(deviceType, holderStructures, StructureChoice.STRUCTURE),
+                StructureElementUtil.getStructureElementProcessed(tmpDeviceType, holderTmpStructures, StructureChoice.STRUCTURE),
                 NotificationUtil.prepareNotification(Type.DEVICETYPE, StructureCommand.CREATE, null, tmpDeviceType, holderTmpStructures));
     }
 
     @Transactional(propagation = Propagation.MANDATORY)
     public StructureElementNotification updateStructure(StructureElementCommand structureElementCommand, Date when, String username,
-            EssNamingConvention namingConvention, HolderStructures holderStructures, HolderTmpStructures holderTmpStructures) {
+            EssNamingConvention namingConvention, HolderTmpStructures holderTmpStructures) {
 
         // validation outside method
         // transaction
         //     support a current transaction, throw an exception if none exists
-        //     update structure - not latest
-        //     create structure - approved, latest, not deleted
+        //     update structure
+        //     create audit
         //     previous for notification
         //     additional
         //         update related names
@@ -158,25 +137,8 @@ public class DeviceTypeService {
         mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic;
         String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic);
 
-        // update
-        List<DeviceType> deviceTypes = deviceTypeRepository.readDeviceTypes(Boolean.FALSE, uuid, null, null, null, null, null, null);
-        DeviceType deviceType = null;
-        if (ValidateUtil.isSize(deviceTypes, 1)) {
-            deviceType = deviceTypes.get(0);
-            deviceType.setLatest(Boolean.FALSE);
-            deviceTypeRepository.updateDeviceType(deviceType);
-        }
-
-        // create
-        deviceType = new DeviceType(structureElementCommand.getUuid(), structureElementCommand.getParent(),
-                mnemonic, equivalenceClassRepresentative, structureElementCommand.getOrdering(),
-                structureElementCommand.getDescription(), Status.APPROVED, Boolean.TRUE, Boolean.FALSE,
-                when, username, null);
-        deviceTypeRepository.createDeviceType(deviceType);
-
-        // update tmp
+        // update structure
         // create audit
-        // <TMP>
         TmpDeviceType tmpDeviceType = iTmpDeviceTypeRepository.findByUuid(uuid);
         tmpDeviceType.setMnemonic(mnemonic);
         tmpDeviceType.setMnemonicEquivalence(equivalenceClassRepresentative);
@@ -185,35 +147,30 @@ public class DeviceTypeService {
         tmpDeviceTypeRepository.updateDeviceType(tmpDeviceType);
         TmpAuditStructure tmpAuditStructure = new TmpAuditStructure(TextUtil.UPDATE, tmpDeviceType);
         tmpAuditStructureRepository.createTmpAuditStructure(tmpAuditStructure);
-        // </TMP>
 
         // previous
-        List<DeviceType> previouses = iDeviceTypeRepository.findPreviousByUuidAndId(deviceType.getUuid().toString(), deviceType.getId());
-        DeviceType previous = previouses != null && !previouses.isEmpty() ? previouses.get(0) : null;
-        // <TMP>
         TmpAuditStructure tmpPreviousAuditStructure = iTmpAuditStructureRepository.findPreviousByAuditTableAndUuidAndAuditId(Type.DEVICETYPE.name().toLowerCase(), uuid, tmpAuditStructure.getAuditId());
-        TmpDeviceType tmpPrevious = StructureUtil.convert2DeviceType(tmpPreviousAuditStructure);
-        // </TMP>
+        TmpDeviceType tmpPrevious = new TmpDeviceType(tmpPreviousAuditStructure);
 
         // additional
-        namesService.updateNames(previous, deviceType, username);
+        namesService.updateNames(tmpPrevious, tmpDeviceType, username, holderTmpStructures);
 
         LOGGER.log(Level.FINE, () -> MessageFormat.format(TextUtil.DESCRIPTION_NAME_VALUE, TextUtil.UPDATE_STRUCTURE, TextUtil.COMMAND, StructureCommand.UPDATE));
 
         return new StructureElementNotification(
-                StructureElementUtil.getStructureElementProcessed(deviceType, holderStructures, StructureChoice.STRUCTURE),
+                StructureElementUtil.getStructureElementProcessed(tmpDeviceType, holderTmpStructures, StructureChoice.STRUCTURE),
                 NotificationUtil.prepareNotification(Type.DEVICETYPE, StructureCommand.UPDATE, tmpPrevious, tmpDeviceType, holderTmpStructures));
     }
 
     @Transactional(propagation = Propagation.MANDATORY)
     public StructureElementNotification deleteStructure(StructureElementCommand structureElementCommand, Date when, String username,
-            HolderStructures holderStructures, HolderTmpStructures holderTmpStructures) {
+            HolderTmpStructures holderTmpStructures) {
 
         // validation outside method
         // transaction
         //     support a current transaction, throw an exception if none exists
-        //     update structure - not latest
-        //     create structure - approved, latest, deleted
+        //     delete structure (update)
+        //     create audit
         //     previous for notification
         //     additional
         //         delete related names
@@ -223,50 +180,26 @@ public class DeviceTypeService {
 
         String uuid = structureElementCommand.getUuid().toString();
 
-        // update
-        List<DeviceType> deviceTypes = deviceTypeRepository.readDeviceTypes(Boolean.FALSE, uuid, null, null, null, null, null, null);
-        DeviceType deviceType = null;
-        if (ValidateUtil.isSize(deviceTypes, 1)) {
-            deviceType = deviceTypes.get(0);
-            deviceType.setLatest(Boolean.FALSE);
-            deviceTypeRepository.updateDeviceType(deviceType);
-        } else {
-            return null;
-        }
-
-        // create
-        deviceType = new DeviceType(deviceType.getUuid(), deviceType.getParentUuid(),
-                deviceType.getMnemonic(), deviceType.getMnemonicEquivalence(), deviceType.getOrdering(),
-                deviceType.getDescription(), Status.APPROVED, Boolean.TRUE, Boolean.TRUE,
-                when, username, null);
-        deviceTypeRepository.createDeviceType(deviceType);
-
-        // update tmp
+        // delete structure
         // create audit
-        // <TMP>
         TmpDeviceType tmpDeviceType = iTmpDeviceTypeRepository.findByUuid(uuid);
         tmpDeviceType.setDeleted(Boolean.TRUE);
         tmpDeviceType.setAttributesProcessed(when, username, null);
         tmpDeviceTypeRepository.updateDeviceType(tmpDeviceType);
         TmpAuditStructure tmpAuditStructure = new TmpAuditStructure(TextUtil.DELETE, tmpDeviceType);
         tmpAuditStructureRepository.createTmpAuditStructure(tmpAuditStructure);
-        // </TMP>
 
         // previous
-        List<DeviceType> previouses = iDeviceTypeRepository.findPreviousByUuidAndId(uuid, deviceType.getId());
-        DeviceType previous = previouses != null && !previouses.isEmpty() ? previouses.get(0) : null;
-        // <TMP>
         TmpAuditStructure tmpPreviousAuditStructure = iTmpAuditStructureRepository.findPreviousByAuditTableAndUuidAndAuditId(Type.DEVICETYPE.name().toLowerCase(), uuid, tmpAuditStructure.getAuditId());
-        TmpDeviceType tmpPrevious = StructureUtil.convert2DeviceType(tmpPreviousAuditStructure);
-        // </TMP>
+        TmpDeviceType tmpPrevious = new TmpDeviceType(tmpPreviousAuditStructure);
 
         // additional
-        namesService.deleteNames(deviceType, username);
+        namesService.deleteNames(tmpDeviceType, username, holderTmpStructures);
 
         LOGGER.log(Level.FINE, () -> MessageFormat.format(TextUtil.DESCRIPTION_NAME_VALUE, TextUtil.DELETE_STRUCTURE, TextUtil.COMMAND, StructureCommand.DELETE));
 
         return new StructureElementNotification(
-                StructureElementUtil.getStructureElementProcessed(deviceType, holderStructures, StructureChoice.STRUCTURE),
+                StructureElementUtil.getStructureElementProcessed(tmpDeviceType, holderTmpStructures, StructureChoice.STRUCTURE),
                 NotificationUtil.prepareNotification(Type.DEVICETYPE, StructureCommand.DELETE, tmpPrevious, tmpDeviceType, holderTmpStructures));
     }
 
diff --git a/src/main/java/org/openepics/names/service/DisciplineService.java b/src/main/java/org/openepics/names/service/DisciplineService.java
index a6b8b2a8..90582cd6 100644
--- a/src/main/java/org/openepics/names/service/DisciplineService.java
+++ b/src/main/java/org/openepics/names/service/DisciplineService.java
@@ -26,14 +26,11 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.apache.commons.lang3.StringUtils;
-import org.openepics.names.repository.DisciplineRepository;
-import org.openepics.names.repository.IDeviceGroupRepository;
-import org.openepics.names.repository.IDisciplineRepository;
-import org.openepics.names.repository.model.DeviceGroup;
-import org.openepics.names.repository.model.Discipline;
 import org.openepics.names.repository.model.tmp.TmpAuditStructure;
+import org.openepics.names.repository.model.tmp.TmpDeviceGroup;
 import org.openepics.names.repository.model.tmp.TmpDiscipline;
 import org.openepics.names.repository.tmp.ITmpAuditStructureRepository;
+import org.openepics.names.repository.tmp.ITmpDeviceGroupRepository;
 import org.openepics.names.repository.tmp.ITmpDisciplineRepository;
 import org.openepics.names.repository.tmp.TmpAuditStructureRepository;
 import org.openepics.names.repository.tmp.TmpDisciplineRepository;
@@ -41,14 +38,11 @@ import org.openepics.names.rest.beans.Status;
 import org.openepics.names.rest.beans.Type;
 import org.openepics.names.rest.beans.element.StructureElementCommand;
 import org.openepics.names.util.EssNamingConvention;
-import org.openepics.names.util.HolderStructures;
 import org.openepics.names.util.HolderTmpStructures;
 import org.openepics.names.util.StructureChoice;
 import org.openepics.names.util.StructureCommand;
 import org.openepics.names.util.StructureElementUtil;
-import org.openepics.names.util.StructureUtil;
 import org.openepics.names.util.TextUtil;
-import org.openepics.names.util.ValidateUtil;
 import org.openepics.names.util.notification.NotificationUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -69,9 +63,7 @@ public class DisciplineService {
 
     private NamesService namesService;
     private DeviceGroupService deviceGroupService;
-    private IDisciplineRepository iDisciplineRepository;
-    private IDeviceGroupRepository iDeviceGroupRepository;
-    private DisciplineRepository disciplineRepository;
+    private ITmpDeviceGroupRepository iTmpDeviceGroupRepository;
     private ITmpDisciplineRepository iTmpDisciplineRepository;
     private ITmpAuditStructureRepository iTmpAuditStructureRepository;
     private TmpDisciplineRepository tmpDisciplineRepository;
@@ -81,18 +73,14 @@ public class DisciplineService {
     public DisciplineService(
             NamesService namesService,
             DeviceGroupService deviceGroupService,
-            IDisciplineRepository iDisciplineRepository,
-            IDeviceGroupRepository iDeviceGroupRepository,
-            DisciplineRepository disciplineRepository,
+            ITmpDeviceGroupRepository iTmpDeviceGroupRepository,
             ITmpDisciplineRepository iTmpDisciplineRepository,
             ITmpAuditStructureRepository iTmpAuditStructureRepository,
             TmpDisciplineRepository tmpDisciplineRepository,
             TmpAuditStructureRepository tmpAuditStructureRepository) {
         this.namesService = namesService;
         this.deviceGroupService = deviceGroupService;
-        this.iDisciplineRepository = iDisciplineRepository;
-        this.iDeviceGroupRepository = iDeviceGroupRepository;
-        this.disciplineRepository = disciplineRepository;
+        this.iTmpDeviceGroupRepository = iTmpDeviceGroupRepository;
         this.iTmpDisciplineRepository = iTmpDisciplineRepository;
         this.iTmpAuditStructureRepository = iTmpAuditStructureRepository;
         this.tmpDisciplineRepository = tmpDisciplineRepository;
@@ -101,12 +89,13 @@ public class DisciplineService {
 
     @Transactional(propagation = Propagation.MANDATORY)
     public StructureElementNotification createStructure(StructureElementCommand structureElementCommand, Date when, String username,
-            EssNamingConvention namingConvention, HolderStructures holderStructures, HolderTmpStructures holderTmpStructures) {
+            EssNamingConvention namingConvention, HolderTmpStructures holderTmpStructures) {
 
         // validation outside method
         // transaction
         //     support a current transaction, throw an exception if none exists
-        //     create structure - approved, latest, not deleted
+        //     create structure
+        //     create audit
         //     return
         //         structure element for created structure
         //         notification
@@ -116,40 +105,31 @@ public class DisciplineService {
         mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic;
         String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic);
 
-        // create
-        Discipline discipline = new Discipline(uuid,
-                mnemonic, equivalenceClassRepresentative, structureElementCommand.getOrdering(),
-                structureElementCommand.getDescription(), Status.APPROVED, Boolean.TRUE, Boolean.FALSE,
-                when, username, null);
-        disciplineRepository.createDiscipline(discipline);
-
-        // create tmp
+        // create structure
         // create audit
-        // <TMP>
         TmpDiscipline tmpDiscipline = new TmpDiscipline(uuid,
                 mnemonic, equivalenceClassRepresentative, structureElementCommand.getOrdering(),
                 structureElementCommand.getDescription(), Status.APPROVED, Boolean.FALSE,
                 when, username, null);
         tmpDisciplineRepository.createDiscipline(tmpDiscipline);
         tmpAuditStructureRepository.createTmpAuditStructure(new TmpAuditStructure(TextUtil.CREATE, tmpDiscipline));
-        // </TMP>
 
         LOGGER.log(Level.FINE, () -> MessageFormat.format(TextUtil.DESCRIPTION_NAME_VALUE, TextUtil.CREATE_STRUCTURE, TextUtil.COMMAND, StructureCommand.CREATE));
 
         return new StructureElementNotification(
-                StructureElementUtil.getStructureElementProcessed(discipline, holderStructures, StructureChoice.STRUCTURE),
+                StructureElementUtil.getStructureElementProcessed(tmpDiscipline, holderTmpStructures, StructureChoice.STRUCTURE),
                 NotificationUtil.prepareNotification(Type.DISCIPLINE, StructureCommand.CREATE, null, tmpDiscipline, holderTmpStructures));
     }
 
     @Transactional(propagation = Propagation.MANDATORY)
     public StructureElementNotification updateStructure(StructureElementCommand structureElementCommand, Date when, String username,
-            EssNamingConvention namingConvention, HolderStructures holderStructures, HolderTmpStructures holderTmpStructures) {
+            EssNamingConvention namingConvention, HolderTmpStructures holderTmpStructures) {
 
         // validation outside method
         // transaction
         //     support a current transaction, throw an exception if none exists
-        //     update structure - not latest
-        //     create structure - approved, latest, not deleted
+        //     update structure
+        //     create audit
         //     previous for notification
         //     additional
         //         update related names
@@ -162,25 +142,8 @@ public class DisciplineService {
         mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic;
         String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic);
 
-        // update
-        List<Discipline> disciplines = disciplineRepository.readDisciplines(Boolean.FALSE, uuid, null, null, null, null, null);
-        Discipline discipline = null;
-        if (ValidateUtil.isSize(disciplines, 1)) {
-            discipline = disciplines.get(0);
-            discipline.setLatest(Boolean.FALSE);
-            disciplineRepository.updateDiscipline(discipline);
-        }
-
-        // create
-        discipline = new Discipline(structureElementCommand.getUuid(),
-                mnemonic, equivalenceClassRepresentative, structureElementCommand.getOrdering(),
-                structureElementCommand.getDescription(), Status.APPROVED, Boolean.TRUE, Boolean.FALSE,
-                when, username, null);
-        disciplineRepository.createDiscipline(discipline);
-
-        // update tmp
+        // update structure
         // create audit
-        // <TMP>
         TmpDiscipline tmpDiscipline = iTmpDisciplineRepository.findByUuid(uuid);
         tmpDiscipline.setMnemonic(mnemonic);
         tmpDiscipline.setMnemonicEquivalence(equivalenceClassRepresentative);
@@ -189,35 +152,30 @@ public class DisciplineService {
         tmpDisciplineRepository.updateDiscipline(tmpDiscipline);
         TmpAuditStructure tmpAuditStructure = new TmpAuditStructure(TextUtil.UPDATE, tmpDiscipline);
         tmpAuditStructureRepository.createTmpAuditStructure(tmpAuditStructure);
-        // </TMP>
 
         // previous
-        List<Discipline> previouses = iDisciplineRepository.findPreviousByUuidAndId(discipline.getUuid().toString(), discipline.getId());
-        Discipline previous = previouses != null && !previouses.isEmpty() ? previouses.get(0) : null;
-        // <TMP>
         TmpAuditStructure tmpPreviousAuditStructure = iTmpAuditStructureRepository.findPreviousByAuditTableAndUuidAndAuditId(Type.DISCIPLINE.name().toLowerCase(), uuid, tmpAuditStructure.getAuditId());
-        TmpDiscipline tmpPrevious = StructureUtil.convert2Discipline(tmpPreviousAuditStructure);
-        // </TMP>
+        TmpDiscipline tmpPrevious = new TmpDiscipline(tmpPreviousAuditStructure);
 
         // additional
-        namesService.updateNames(previous, discipline, username);
+        namesService.updateNames(tmpPrevious, tmpDiscipline, username, holderTmpStructures);
 
         LOGGER.log(Level.FINE, () -> MessageFormat.format(TextUtil.DESCRIPTION_NAME_VALUE, TextUtil.UPDATE_STRUCTURE, TextUtil.COMMAND, StructureCommand.UPDATE));
 
         return new StructureElementNotification(
-                StructureElementUtil.getStructureElementProcessed(discipline, holderStructures, StructureChoice.STRUCTURE),
+                StructureElementUtil.getStructureElementProcessed(tmpDiscipline, holderTmpStructures, StructureChoice.STRUCTURE),
                 NotificationUtil.prepareNotification(Type.DISCIPLINE, StructureCommand.UPDATE, tmpPrevious, tmpDiscipline, holderTmpStructures));
     }
 
     @Transactional(propagation = Propagation.MANDATORY)
     public StructureElementNotification deleteStructure(StructureElementCommand structureElementCommand, Date when, String username,
-            HolderStructures holderStructures, HolderTmpStructures holderTmpStructures) {
+            HolderTmpStructures holderTmpStructures) {
 
         // validation outside method
         // transaction
         //     support a current transaction, throw an exception if none exists
-        //     update structure - not latest
-        //     create structure - approved, latest, deleted
+        //     delete structure (update)
+        //     create audit
         //     previous for notification
         //     additional
         //         delete related names
@@ -228,60 +186,36 @@ public class DisciplineService {
 
         String uuid = structureElementCommand.getUuid().toString();
 
-        // update
-        List<Discipline> disciplines = disciplineRepository.readDisciplines(Boolean.FALSE, uuid, null, null, null, null, null);
-        Discipline discipline = null;
-        if (ValidateUtil.isSize(disciplines, 1)) {
-            discipline = disciplines.get(0);
-            discipline.setLatest(Boolean.FALSE);
-            disciplineRepository.updateDiscipline(discipline);
-        } else {
-            return null;
-        }
-
-        // create
-        discipline = new Discipline(discipline.getUuid(),
-                discipline.getMnemonic(), discipline.getMnemonicEquivalence(), discipline.getOrdering(),
-                discipline.getDescription(), Status.APPROVED, Boolean.TRUE, Boolean.TRUE,
-                when, username, null);
-        disciplineRepository.createDiscipline(discipline);
-
-        // update tmp
+        // delete structure
         // create audit
-        // <TMP>
         TmpDiscipline tmpDiscipline = iTmpDisciplineRepository.findByUuid(uuid);
         tmpDiscipline.setDeleted(Boolean.TRUE);
         tmpDiscipline.setAttributesProcessed(when, username, null);
         tmpDisciplineRepository.updateDiscipline(tmpDiscipline);
         TmpAuditStructure tmpAuditStructure = new TmpAuditStructure(TextUtil.DELETE, tmpDiscipline);
         tmpAuditStructureRepository.createTmpAuditStructure(tmpAuditStructure);
-        // </TMP>
 
         // previous
-        List<Discipline> previouses = iDisciplineRepository.findPreviousByUuidAndId(uuid, discipline.getId());
-        Discipline previous = previouses != null && !previouses.isEmpty() ? previouses.get(0) : null;
-        // <TMP>
         TmpAuditStructure tmpPreviousAuditStructure = iTmpAuditStructureRepository.findPreviousByAuditTableAndUuidAndAuditId(Type.DISCIPLINE.name().toLowerCase(), uuid, tmpAuditStructure.getAuditId());
-        TmpDiscipline tmpPrevious = StructureUtil.convert2Discipline(tmpPreviousAuditStructure);
-        // </TMP>
+        TmpDiscipline tmpPrevious = new TmpDiscipline(tmpPreviousAuditStructure);
 
         // additional
         //     will propagate to sub structures
-        namesService.deleteNames(discipline, username);
+        namesService.deleteNames(tmpDiscipline, username, holderTmpStructures);
 
         List<StructureElementCommand> commands = Lists.newArrayList();
-        List<DeviceGroup> deviceGroups = iDeviceGroupRepository.findLatestNotDeletedByParent(uuid);
-        for (DeviceGroup deviceGroup : deviceGroups) {
+        List<TmpDeviceGroup> deviceGroups = iTmpDeviceGroupRepository.findNotDeletedByParent(tmpDiscipline.getId());
+        for (TmpDeviceGroup deviceGroup : deviceGroups) {
             commands.add(new StructureElementCommand(deviceGroup.getUuid(), Type.DEVICEGROUP, null, null, null, null));
         }
         for (StructureElementCommand command : commands) {
-            deviceGroupService.deleteStructure(command, when, username, holderStructures, holderTmpStructures);
+            deviceGroupService.deleteStructure(command, when, username, holderTmpStructures);
         }
 
         LOGGER.log(Level.FINE, () -> MessageFormat.format(TextUtil.DESCRIPTION_NAME_VALUE, TextUtil.DELETE_STRUCTURE, TextUtil.COMMAND, StructureCommand.DELETE));
 
         return new StructureElementNotification(
-                StructureElementUtil.getStructureElementProcessed(discipline, holderStructures, StructureChoice.STRUCTURE),
+                StructureElementUtil.getStructureElementProcessed(tmpDiscipline, holderTmpStructures, StructureChoice.STRUCTURE),
                 NotificationUtil.prepareNotification(Type.DISCIPLINE, StructureCommand.DELETE, tmpPrevious, tmpDiscipline, holderTmpStructures));
     }
 
diff --git a/src/main/java/org/openepics/names/service/NamesService.java b/src/main/java/org/openepics/names/service/NamesService.java
index 790b6c89..65e8aded 100644
--- a/src/main/java/org/openepics/names/service/NamesService.java
+++ b/src/main/java/org/openepics/names/service/NamesService.java
@@ -26,30 +26,11 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.apache.commons.lang3.StringUtils;
-import org.openepics.names.repository.DeviceGroupRepository;
-import org.openepics.names.repository.DeviceTypeRepository;
-import org.openepics.names.repository.DisciplineRepository;
-import org.openepics.names.repository.IDeviceGroupRepository;
-import org.openepics.names.repository.IDeviceTypeRepository;
-import org.openepics.names.repository.IDisciplineRepository;
-import org.openepics.names.repository.INameRepository;
-import org.openepics.names.repository.ISubsystemRepository;
-import org.openepics.names.repository.ISystemGroupRepository;
-import org.openepics.names.repository.ISystemRepository;
-import org.openepics.names.repository.NameRepository;
-import org.openepics.names.repository.SubsystemRepository;
-import org.openepics.names.repository.SystemGroupRepository;
-import org.openepics.names.repository.SystemRepository;
-import org.openepics.names.repository.model.DeviceType;
-import org.openepics.names.repository.model.Discipline;
-import org.openepics.names.repository.model.Name;
-import org.openepics.names.repository.model.Structure;
-import org.openepics.names.repository.model.Subsystem;
-import org.openepics.names.repository.model.System;
-import org.openepics.names.repository.model.SystemGroup;
 import org.openepics.names.repository.model.tmp.TmpAuditName;
 import org.openepics.names.repository.model.tmp.TmpDeviceType;
+import org.openepics.names.repository.model.tmp.TmpDiscipline;
 import org.openepics.names.repository.model.tmp.TmpName;
+import org.openepics.names.repository.model.tmp.TmpStructure;
 import org.openepics.names.repository.model.tmp.TmpSubsystem;
 import org.openepics.names.repository.model.tmp.TmpSystem;
 import org.openepics.names.repository.model.tmp.TmpSystemGroup;
@@ -77,10 +58,7 @@ import org.openepics.names.rest.beans.element.NameElement;
 import org.openepics.names.rest.beans.element.NameElementCommand;
 import org.openepics.names.rest.beans.response.ResponsePageNameElements;
 import org.openepics.names.util.EssNamingConvention;
-import org.openepics.names.util.HolderIRepositories;
 import org.openepics.names.util.HolderITmpRepositories;
-import org.openepics.names.util.HolderRepositories;
-import org.openepics.names.util.HolderStructures;
 import org.openepics.names.util.HolderTmpRepositories;
 import org.openepics.names.util.HolderTmpStructures;
 import org.openepics.names.util.NameElementUtil;
@@ -103,42 +81,23 @@ import com.google.common.collect.Lists;
 public class NamesService {
 
     // note
+    //     default
+    //         active means valid not deleted
+    //         obsolete values are not shown unless history is requested
     //     handling of system structure, device structure
-    //         parent system structure uuid (system group, system, subsystem) - ability to find structure
+    //         parent system structure uuid (system group, system, subsystem)
     //         parent device structure uuid (device type)
-    //     holder
-    //         HolderIRepositories and HolderSystemDeviceStructure may or may not be used for preparation of what to return
-    //     latest
-    //         automatically not show names that do not come into play
-    //         = automatically exclude (approved and not latest)
-    //         otherwise refer to history
     //     namecommand
     //         cud - create update delete
 
     private static final Logger LOGGER = Logger.getLogger(NamesService.class.getName());
 
     private EssNamingConvention namingConvention;
-    private HolderIRepositories holderIRepositories;
-    private HolderRepositories holderRepositories;
     private HolderITmpRepositories holderITmpRepositories;
     private HolderTmpRepositories holderTmpRepositories;
 
     @Autowired
     public NamesService(
-            INameRepository iNameRepository,
-            ISystemGroupRepository iSystemGroupRepository,
-            ISystemRepository iSystemRepository,
-            ISubsystemRepository iSubsystemRepository,
-            IDisciplineRepository iDisciplineRepository,
-            IDeviceGroupRepository iDeviceGroupRepository,
-            IDeviceTypeRepository iDeviceTypeRepository,
-            NameRepository nameRepository,
-            SystemGroupRepository systemGroupRepository,
-            SystemRepository systemRepository,
-            SubsystemRepository subsystemRepository,
-            DisciplineRepository disciplineRepository,
-            DeviceGroupRepository deviceGroupRepository,
-            DeviceTypeRepository deviceTypeRepository,
             ITmpNameRepository iTmpNameRepository,
             ITmpSystemGroupRepository iTmpSystemGroupRepository,
             ITmpSystemRepository iTmpSystemRepository,
@@ -159,22 +118,6 @@ public class NamesService {
             TmpAuditStructureRepository tmpAuditStructureRepository) {
 
         this.namingConvention = new EssNamingConvention();
-        this.holderIRepositories = new HolderIRepositories(
-                iNameRepository,
-                iSystemGroupRepository,
-                iSystemRepository,
-                iSubsystemRepository,
-                iDisciplineRepository,
-                iDeviceGroupRepository,
-                iDeviceTypeRepository);
-        this.holderRepositories = new HolderRepositories(
-                nameRepository,
-                systemGroupRepository,
-                systemRepository,
-                subsystemRepository,
-                disciplineRepository,
-                deviceGroupRepository,
-                deviceTypeRepository);
         this.holderITmpRepositories = new HolderITmpRepositories(
                 iTmpNameRepository,
                 iTmpSystemGroupRepository,
@@ -208,13 +151,12 @@ public class NamesService {
         //     return name elements for created names
 
         // holder of valid content for system and device structures
-        HolderStructures holderStructures = new HolderStructures(holderIRepositories);
         HolderTmpStructures holderTmpStructures = new HolderTmpStructures(holderITmpRepositories);
 
         Date when = new Date();
         final List<NameElement> createdNameElements = Lists.newArrayList();
         for (NameElementCommand nameElementCommand : nameElementCommands) {
-            NameElement createdNameElement = createName(nameElementCommand, when, username, holderStructures, holderTmpStructures);
+            NameElement createdNameElement = createName(nameElementCommand, when, username, holderTmpStructures);
             createdNameElements.add(createdNameElement);
 
             if (LOGGER.isLoggable(Level.FINER)) {
@@ -231,13 +173,19 @@ public class NamesService {
                         createdNameElements.size()));
         return createdNameElements;
     }
+
+    @Transactional(propagation = Propagation.MANDATORY)
+    public NameElement createName(NameElementCommand nameElementCommand, Date when, String username, HolderTmpStructures holderTmpStructures) {
+        return createName(nameElementCommand, when, username, holderTmpStructures, null);
+    }
     @Transactional(propagation = Propagation.MANDATORY)
-    public NameElement createName(NameElementCommand nameElementCommand, Date when, String username, HolderStructures holderStructures, HolderTmpStructures holderTmpStructures) {
+    public NameElement createName(NameElementCommand nameElementCommand, Date when, String username, HolderTmpStructures holderTmpStructures, TmpStructure structure) {
         // validation outside method
         // transaction
         //     support a current transaction, throw an exception if none exists
         //     find & prepare
-        //     create name - approved, latest, not deleted, uuid
+        //     create name
+        //     create audit
         //     return name element for created name
 
         UUID uuid = UUID.randomUUID();
@@ -245,41 +193,11 @@ public class NamesService {
         UUID parentDeviceStructure = nameElementCommand.getParentDeviceStructure();
         String index = nameElementCommand.getIndex();
         String description = nameElementCommand.getDescription();
+        String comment = null;
 
         // find & prepare
         //     system structure - system group, system, subsystem - one of the three expected to be non-null, other two expected to be null
         //     device structure - device type - may be null
-        SystemGroup systemGroup = holderIRepositories.systemGroupRepository().findLatestByUuid(parentSystemStructure.toString());
-        System      system      = holderIRepositories.systemRepository().findLatestByUuid(parentSystemStructure.toString());
-        Subsystem   subsystem   = holderIRepositories.subsystemRepository().findLatestByUuid(parentSystemStructure.toString());
-        DeviceType  deviceType  = null;
-        if (parentDeviceStructure != null) {
-            deviceType = holderIRepositories.deviceTypeRepository().findLatestByUuid(parentDeviceStructure.toString());
-        }
-
-        String derivedName = null;
-        if (systemGroup != null) {
-            derivedName = NameUtil.getName(systemGroup, deviceType, index, holderStructures);
-        } else if (system != null) {
-            derivedName = NameUtil.getName(system, deviceType, index, holderStructures);
-        } else if (subsystem != null) {
-            derivedName = NameUtil.getName(subsystem, deviceType, index, holderStructures);
-        }
-
-        // create
-        Name name = new Name(uuid,
-                systemGroup != null ? systemGroup.getUuid() : null,
-                system != null ? system.getUuid() : null,
-                subsystem != null ? subsystem.getUuid() : null,
-                parentDeviceStructure,
-                index, derivedName, namingConvention.equivalenceClassRepresentative(derivedName), description,
-                Status.APPROVED, Boolean.TRUE, Boolean.FALSE,
-                when, username, null);
-        holderRepositories.nameRepository().createName(name);
-
-        // create tmp
-        // create audit
-        // <TMP>
         TmpSystemGroup tmpSystemGroup = holderITmpRepositories.systemGroupRepository().findByUuid(parentSystemStructure.toString());
         TmpSystem tmpSystem = holderITmpRepositories.systemRepository().findByUuid(parentSystemStructure.toString());
         TmpSubsystem tmpSubsystem = holderITmpRepositories.subsystemRepository().findByUuid(parentSystemStructure.toString());
@@ -297,6 +215,8 @@ public class NamesService {
             tmpDerivedName = NameUtil.getName(tmpSubsystem, tmpDeviceType, index, holderTmpStructures);
         }
 
+        // create name
+        // create audit
         TmpName tmpName = new TmpName(uuid,
                 tmpSystemGroup != null ? tmpSystemGroup.getId() : null,
                 tmpSystem != null ? tmpSystem.getId() : null,
@@ -304,12 +224,11 @@ public class NamesService {
                 tmpDeviceType != null ? tmpDeviceType.getId() : null,
                 index, tmpDerivedName, namingConvention.equivalenceClassRepresentative(tmpDerivedName), description,
                 Status.APPROVED, Boolean.FALSE,
-                when, username, null);
+                when, username, comment);
         holderTmpRepositories.nameRepository().createName(tmpName);
         holderTmpRepositories.auditNameRepository().createAuditName(new TmpAuditName(TextUtil.CREATE, tmpName));
-        // </TMP>
 
-        return NameElementUtil.getNameElement(name);
+        return NameElementUtil.getNameElement(tmpName, holderTmpStructures, structure);
     }
 
     // ----------------------------------------------------------------------------------------------------
@@ -345,58 +264,25 @@ public class NamesService {
             LOGGER.log(Level.FINE, MessageFormat.format(TextUtil.DESCRIPTION_NAME_VALUE, TextUtil.READ_NAMES, "limit", limit));
         }
 
-        List<Name> names = null;
+        // holder of valid content for system and device structures
+        HolderTmpStructures holderTmpStructures = new HolderTmpStructures(holderITmpRepositories);
+
+        // one name entry will give one name element
+        //     history does not affect totalCount, sorting, pagination
+        List<NameElement> nameElements = null;
         Long totalCount = null;
         if (Boolean.TRUE.equals(includeHistory)) {
-            names = holderRepositories.nameRepository().readNamesHistory(uuid, name, null, systemStructure, deviceStructure, index, description, who, orderBy, isAsc, offset, limit);
-            totalCount = holderRepositories.nameRepository().countNamesHistory(uuid, name, null, systemStructure, deviceStructure, index, description, who);
-
-            // <TMP>
-            LOGGER.log(Level.INFO, "readNames, history, names.size:              " + names.size());
-            LOGGER.log(Level.INFO, "readNames, history, totalCount:              " + totalCount);
-
-            List<TmpName> tmpNames = null;
-            Long tmpNamesCount = null;
-            List<TmpAuditName> tmpAuditNames = null;
-            Long tmpAuditNamesCount = null;
-
-            tmpNames = holderTmpRepositories.nameRepository().readNames(deleted, uuid, name, name, systemStructure, deviceStructure, index, description, who, orderBy, isAsc, offset, limit);
-            tmpNamesCount = holderTmpRepositories.nameRepository().countNames(deleted, uuid, name, name, systemStructure, deviceStructure, index, description, who);
-
-            LOGGER.log(Level.INFO, "readNames, history,      tmpNames.size:      " + tmpNames.size());
-            LOGGER.log(Level.INFO, "readNames, history,      tmpNamesCount:      " + tmpNamesCount);
-
-            tmpAuditNames = holderTmpRepositories.auditNameRepository().readAuditNames(uuid, offset, limit);
-            tmpAuditNamesCount = holderTmpRepositories.auditNameRepository().countAuditNames(uuid);
-
-            LOGGER.log(Level.INFO, "readNames, history,      tmpAuditNames.size: " + tmpAuditNames.size());
-            LOGGER.log(Level.INFO, "readNames, history,      tmpAuditNamesCount: " + tmpAuditNamesCount);
-            // </TMP>
+            List<TmpAuditName> tmpAuditNames = holderTmpRepositories.auditNameRepository().readAuditNames(uuid, offset, limit);
+            totalCount = holderTmpRepositories.auditNameRepository().countAuditNames(uuid);
 
+            nameElements = NameElementUtil.getNameElementsForAuditNames(tmpAuditNames, holderTmpStructures);
         } else {
-            names = holderRepositories.nameRepository().readNames(deleted, uuid, name, null, systemStructure, deviceStructure, index, description, who, includeHistory, orderBy, isAsc, offset, limit);
-            totalCount = holderRepositories.nameRepository().countNames(deleted, uuid, name, null, systemStructure, deviceStructure, index, description, who, includeHistory);
-
-            // <TMP>
-            LOGGER.log(Level.INFO, "readNames, names.size:                       " + names.size());
-            LOGGER.log(Level.INFO, "readNames, totalCount:                       " + totalCount);
-
-            List<TmpName> tmpNames = null;
-            Long tmpNamesCount = null;
-
-            tmpNames = holderTmpRepositories.nameRepository().readNames(deleted, uuid, name, name, systemStructure, deviceStructure, index, description, who, orderBy, isAsc, offset, limit);
-            tmpNamesCount = holderTmpRepositories.nameRepository().countNames(deleted, uuid, name, name, systemStructure, deviceStructure, index, description, who);
+            List<TmpName> tmpNames = holderTmpRepositories.nameRepository().readNames(deleted, uuid, name, null, systemStructure, deviceStructure, index, description, who, orderBy, isAsc, offset, limit);
+            totalCount = holderTmpRepositories.nameRepository().countNames(deleted, uuid, name, null, systemStructure, deviceStructure, index, description, who);
 
-            LOGGER.log(Level.INFO, "readNames,                                   tmpNames.size: " + tmpNames.size());
-            LOGGER.log(Level.INFO, "readNames,                                   tmpNamesCount: " + tmpNamesCount);
-            // </TMP>
+            nameElements = NameElementUtil.getNameElements(tmpNames, holderTmpStructures);
         }
 
-        // one name entry will give one name element
-        //     history does not affect totalCount, sorting, pagination
-
-        final List<NameElement> nameElements = NameElementUtil.getNameElements(names);
-
         ResponsePageNameElements response = new ResponsePageNameElements(nameElements, totalCount, nameElements.size(), offset, limit);
         LOGGER.log(Level.FINE,
                 () -> MessageFormat.format(
@@ -455,24 +341,6 @@ public class NamesService {
         //     otherwise ordering and pagination will be messy
         //     consider multiplicity if search for both system structure uuid and device structure uuid
 
-        List<Name> names = Lists.newArrayList();
-
-        // directly
-        names.addAll(holderRepositories.nameRepository().readNamesLatestByStructure(NameRepository.NameByStructure.NAME_BY_SYSTEMGROUP, uuid, deleted, orderBy, isAsc));
-        names.addAll(holderRepositories.nameRepository().readNamesLatestByStructure(NameRepository.NameByStructure.NAME_BY_SYSTEM, uuid, deleted, orderBy, isAsc));
-        names.addAll(holderRepositories.nameRepository().readNamesLatestByStructure(NameRepository.NameByStructure.NAME_BY_SUBSYSTEM, uuid, deleted, orderBy, isAsc));
-        names.addAll(holderRepositories.nameRepository().readNamesLatestByStructure(NameRepository.NameByStructure.NAME_BY_DEVICETYPE, uuid, deleted, orderBy, isAsc));
-
-        // indirectly
-        names.addAll(holderRepositories.nameRepository().readNamesLatestByStructure(NameRepository.NameByStructure.NAME_BY_SYSTEMGROUP_THROUGH_SYSTEM, uuid, deleted, orderBy, isAsc));
-        names.addAll(holderRepositories.nameRepository().readNamesLatestByStructure(NameRepository.NameByStructure.NAME_BY_SYSTEMGROUP_THROUGH_SUBSYSTEM, uuid, deleted, orderBy, isAsc));
-        names.addAll(holderRepositories.nameRepository().readNamesLatestByStructure(NameRepository.NameByStructure.NAME_BY_SYSTEM_THROUGH_SUBSYSTEM, uuid, deleted, orderBy, isAsc));
-        names.addAll(holderRepositories.nameRepository().readNamesLatestByStructure(NameRepository.NameByStructure.NAME_BY_DISCIPLINE_THROUGH_DEVICETYPE, uuid, deleted, orderBy, isAsc));
-        names.addAll(holderRepositories.nameRepository().readNamesLatestByStructure(NameRepository.NameByStructure.NAME_BY_DEVICEGROUP_THROUGH_DEVICETYPE, uuid, deleted, orderBy, isAsc));
-
-        // <TMP>
-        LOGGER.log(Level.INFO, "readNamesStructure, names.size:         " + names.size());
-
         List<TmpName> tmpNames = Lists.newArrayList();
         // directly
         tmpNames.addAll(holderTmpRepositories.nameRepository().readNamesByStructure(TmpNameRepository.NameByStructure.NAME_BY_SYSTEMGROUP, uuid, deleted, orderBy, isAsc));
@@ -487,12 +355,12 @@ public class NamesService {
         tmpNames.addAll(holderTmpRepositories.nameRepository().readNamesByStructure(TmpNameRepository.NameByStructure.NAME_BY_DISCIPLINE_THROUGH_DEVICETYPE, uuid, deleted, orderBy, isAsc));
         tmpNames.addAll(holderTmpRepositories.nameRepository().readNamesByStructure(TmpNameRepository.NameByStructure.NAME_BY_DEVICEGROUP_THROUGH_DEVICETYPE, uuid, deleted, orderBy, isAsc));
 
-        LOGGER.log(Level.INFO, "readNamesStructure, tmpNames.size:      " + tmpNames.size());
-        // </TMP>
+        // holder of valid content for system and device structures
+        HolderTmpStructures holderTmpStructures = new HolderTmpStructures(holderITmpRepositories);
 
         // pagination
-        Long totalCount = Long.valueOf(names.size());
-        final List<NameElement> nameElements = paginate(NameElementUtil.getNameElements(names), offset, limit);
+        Long totalCount = Long.valueOf(tmpNames.size());
+        final List<NameElement> nameElements = paginate(NameElementUtil.getNameElements(tmpNames, holderTmpStructures), offset, limit);
         ResponsePageNameElements response = new ResponsePageNameElements(nameElements, totalCount, nameElements.size(), offset, limit);
 
         LOGGER.log(Level.FINE,
@@ -541,7 +409,7 @@ public class NamesService {
 
         LOGGER.log(Level.FINE, () -> MessageFormat.format(TextUtil.DESCRIPTION_NAME_VALUE, TextUtil.EXISTS_NAME, "name", name));
 
-        List<Name> names = holderRepositories.nameRepository().readNames(false,
+        List<TmpName> names = holderTmpRepositories.nameRepository().readNames(false,
                 null, name, null, null, null, null, null, null);
         return !names.isEmpty();
     }
@@ -634,15 +502,13 @@ public class NamesService {
         // transaction
         //     for each name element
         //         find & prepare
-        //         update name - not latest
-        //         find & prepare
-        //         create name - latest, not deleted, with data
-        //         handle name element for created name
+        //         update name
+        //         create audit
+        //         handle name element for updated name
         //     no notify
         //     return name elements for updated names
 
         // holder of valid content for system and device structures
-        HolderStructures holderStructures = new HolderStructures(holderIRepositories);
         HolderTmpStructures holderTmpStructures = new HolderTmpStructures(holderITmpRepositories);
 
         Date when = new Date();
@@ -655,56 +521,9 @@ public class NamesService {
             String description = nameElementCommand.getDescription();
             String comment = null;
 
-            // find & prepare
-            Name name = holderIRepositories.nameRepository().findLatestByUuid(uuid.toString());
-            if (name == null) {
-                continue;
-            }
-
-            // skip if name element has same content as name
-            //     proceed without fail
-            if (NameElementUtil.hasSameContent(nameElementCommand, name, holderIRepositories, holderStructures)) {
-                continue;
-            }
-
-            // update
-            name.setLatest(Boolean.FALSE);
-            holderRepositories.nameRepository().updateName(name);
-
             // find & prepare
             //     system structure - system group, system, subsystem - one of the three expected to be non-null, other two expected to be null
             //     device structure - device type - may be null
-            SystemGroup systemGroup = holderIRepositories.systemGroupRepository().findLatestByUuid(parentSystemStructure.toString());
-            System      system      = holderIRepositories.systemRepository().findLatestByUuid(parentSystemStructure.toString());
-            Subsystem   subsystem   = holderIRepositories.subsystemRepository().findLatestByUuid(parentSystemStructure.toString());
-            DeviceType  deviceType  = null;
-            if (parentDeviceStructure != null) {
-                deviceType  = holderIRepositories.deviceTypeRepository().findLatestByUuid(parentDeviceStructure.toString());
-            }
-
-            String derivedName = null;
-            if (systemGroup != null) {
-                derivedName = NameUtil.getName(systemGroup, deviceType, index, holderStructures);
-            } else if (system != null) {
-                derivedName = NameUtil.getName(system, deviceType, index, holderStructures);
-            } else if (subsystem != null) {
-                derivedName = NameUtil.getName(subsystem, deviceType, index, holderStructures);
-            }
-
-            // create
-            name = new Name(uuid,
-                    systemGroup != null ? systemGroup.getUuid() : null,
-                    system != null ? system.getUuid() : null,
-                    subsystem != null ? subsystem.getUuid() : null,
-                    parentDeviceStructure,
-                    index, derivedName, namingConvention.equivalenceClassRepresentative(derivedName), description,
-                    Status.APPROVED, Boolean.TRUE, Boolean.FALSE,
-                    when, username, comment);
-            holderRepositories.nameRepository().createName(name);
-
-            // update tmp
-            // create audit
-            // <TMP>
             TmpSystemGroup tmpSystemGroup = holderITmpRepositories.systemGroupRepository().findByUuid(parentSystemStructure.toString());
             TmpSystem tmpSystem = holderITmpRepositories.systemRepository().findByUuid(parentSystemStructure.toString());
             TmpSubsystem tmpSubsystem = holderITmpRepositories.subsystemRepository().findByUuid(parentSystemStructure.toString());
@@ -722,17 +541,26 @@ public class NamesService {
                 tmpDerivedName = NameUtil.getName(tmpSubsystem, tmpDeviceType, index, holderTmpStructures);
             }
 
+            // update name
+            // create audit
             TmpName tmpName = holderITmpRepositories.nameRepository().findByUuid(uuid.toString());
+            if (tmpName == null) {
+                continue;
+            }
+            // skip if name element has same content as name
+            //     proceed without fail
+            if (NameElementUtil.hasSameContent(nameElementCommand, tmpName, holderITmpRepositories, holderTmpStructures)) {
+                continue;
+            }
             tmpName.setInstanceIndex(index);
             tmpName.setConventionName(tmpDerivedName);
             tmpName.setConventionNameEquivalence(namingConvention.equivalenceClassRepresentative(tmpDerivedName));
             tmpName.setDescription(description);
-            tmpName.setAttributesRequested(when, username, null);
+            tmpName.setAttributesRequested(when, username, comment);
             holderTmpRepositories.nameRepository().updateName(tmpName);
             holderTmpRepositories.auditNameRepository().createAuditName(new TmpAuditName(TextUtil.UPDATE, tmpName));
-            // </TMP>
 
-            NameElement updatedNameElement = NameElementUtil.getNameElement(name);
+            NameElement updatedNameElement = NameElementUtil.getNameElement(tmpName, holderTmpStructures);
             updatedNameElements.add(updatedNameElement);
 
             if (LOGGER.isLoggable(Level.FINER)) {
@@ -751,7 +579,7 @@ public class NamesService {
     }
 
     @Transactional(propagation = Propagation.MANDATORY)
-    public List<NameElement> updateNames(Structure previousStructure, Structure structure, String username) {
+    public List<NameElement> updateNames(TmpStructure previousStructure, TmpStructure structure, String username, HolderTmpStructures holderTmpStructures) {
         // validation outside method
         // transaction
         //     support a current transaction, throw an exception if none exists
@@ -765,68 +593,69 @@ public class NamesService {
                 && structure != null
                 && !StringUtils.equals(structure.getMnemonic(), previousStructure.getMnemonic())
                 && !StringUtils.isEmpty(structure.getMnemonic())) {
-            List<Name> names = null;
+            List<TmpName> names = null;
             List<NameElementCommand> nameElements = Lists.newArrayList();
-            UUID parentSystemStructure = null;
-
-            if (previousStructure instanceof SystemGroup && structure instanceof SystemGroup) {
-                // find
-                // prepare
-                names = holderIRepositories.nameRepository().findLatestNotDeletedBySystemGroupUuid(structure.getUuid().toString());
-                for (Name name : names) {
+            UUID parentSystemStructureUuid = null;
+            UUID parentDeviceStructureUuid = null;
+
+            if (previousStructure instanceof TmpSystemGroup && structure instanceof TmpSystemGroup) {
+                names = holderITmpRepositories.nameRepository().findNotDeletedBySystemGroupUuid(structure.getUuid().toString());
+                for (TmpName name : names) {
+                    parentSystemStructureUuid = NameElementUtil.getSystemGroupUuid(name, holderTmpStructures);
+                    parentDeviceStructureUuid = NameElementUtil.getDeviceTypeUuid(name, holderTmpStructures);
                     nameElements.add(
                             new NameElementCommand(
-                                    name.getUuid(), name.getSystemGroupUuid(), name.getDeviceTypeUuid(),
+                                    name.getUuid(), parentSystemStructureUuid, parentDeviceStructureUuid,
                                     name.getInstanceIndex(), name.getDescription()));
                 }
-            } else if (previousStructure instanceof System && structure instanceof System) {
-                // find
-                // prepare
-                names = holderIRepositories.nameRepository().findLatestNotDeletedBySystemUuid(structure.getUuid().toString());
-                for (Name name : names) {
+            } else if (previousStructure instanceof TmpSystem && structure instanceof TmpSystem) {
+                names = holderITmpRepositories.nameRepository().findNotDeletedBySystemUuid(structure.getUuid().toString());
+                for (TmpName name : names) {
+                    parentSystemStructureUuid = NameElementUtil.getSystemUuid(name, holderTmpStructures);
+                    parentDeviceStructureUuid = NameElementUtil.getDeviceTypeUuid(name, holderTmpStructures);
                     nameElements.add(
                             new NameElementCommand(
-                                    name.getUuid(), name.getSystemUuid(), name.getDeviceTypeUuid(),
+                                    name.getUuid(), parentSystemStructureUuid, parentDeviceStructureUuid,
                                     name.getInstanceIndex(), name.getDescription()));
                 }
 
-                names = holderIRepositories.nameRepository().findLatestNotDeletedBySystemUuidThroughSubsystem(structure.getUuid().toString());
-                for (Name name : names) {
+                names = holderITmpRepositories.nameRepository().findNotDeletedBySystemUuidThroughSubsystem(structure.getUuid().toString());
+                for (TmpName name : names) {
+                    parentSystemStructureUuid = NameElementUtil.getSubsystemUuid(name, holderTmpStructures);
+                    parentDeviceStructureUuid = NameElementUtil.getDeviceTypeUuid(name, holderTmpStructures);
                     nameElements.add(
                             new NameElementCommand(
-                                    name.getUuid(), name.getSubsystemUuid(), name.getDeviceTypeUuid(),
+                                    name.getUuid(), parentSystemStructureUuid, parentDeviceStructureUuid,
                                     name.getInstanceIndex(), name.getDescription()));
                 }
-            } else if (previousStructure instanceof Subsystem && structure instanceof Subsystem) {
-                // find
-                // prepare
-                names = holderIRepositories.nameRepository().findLatestNotDeletedBySubsystemUuid(structure.getUuid().toString());
-                for (Name name : names) {
+            } else if (previousStructure instanceof TmpSubsystem && structure instanceof TmpSubsystem) {
+                names = holderITmpRepositories.nameRepository().findNotDeletedBySubsystemUuid(structure.getUuid().toString());
+                for (TmpName name : names) {
+                    parentSystemStructureUuid = NameElementUtil.getSubsystemUuid(name, holderTmpStructures);
+                    parentDeviceStructureUuid = NameElementUtil.getDeviceTypeUuid(name, holderTmpStructures);
                     nameElements.add(
                             new NameElementCommand(
-                                    name.getUuid(), name.getSubsystemUuid(), name.getDeviceTypeUuid(),
+                                    name.getUuid(), parentSystemStructureUuid, parentDeviceStructureUuid,
                                     name.getInstanceIndex(), name.getDescription()));
                 }
-            } else if (previousStructure instanceof Discipline && structure instanceof Discipline) {
-                // find
-                // prepare
-                names = holderIRepositories.nameRepository().findLatestNotDeletedByDisciplineUuidThroughDeviceType(structure.getUuid().toString());
-                for (Name name : names) {
-                    parentSystemStructure = NameUtil.getParentSystemStructure(name);
+            } else if (previousStructure instanceof TmpDiscipline && structure instanceof TmpDiscipline) {
+                names = holderITmpRepositories.nameRepository().findNotDeletedByDisciplineUuidThroughDeviceType(structure.getUuid().toString());
+                for (TmpName name : names) {
+                    parentSystemStructureUuid = NameElementUtil.getParentSystemStructureUuid(name, holderTmpStructures);
+                    parentDeviceStructureUuid = NameElementUtil.getDeviceTypeUuid(name, holderTmpStructures);
                     nameElements.add(
                             new NameElementCommand(
-                                    name.getUuid(), parentSystemStructure, name.getDeviceTypeUuid(),
+                                    name.getUuid(), parentSystemStructureUuid, parentDeviceStructureUuid,
                                     name.getInstanceIndex(), name.getDescription()));
                 }
-            } else if (previousStructure instanceof DeviceType && structure instanceof DeviceType) {
-                // find
-                // prepare
-                names = holderIRepositories.nameRepository().findLatestNotDeletedByDeviceTypeUuid(structure.getUuid().toString());
-                for (Name name : names) {
-                    parentSystemStructure = NameUtil.getParentSystemStructure(name);
+            } else if (previousStructure instanceof TmpDeviceType && structure instanceof TmpDeviceType) {
+                names = holderITmpRepositories.nameRepository().findNotDeletedByDeviceTypeUuid(structure.getUuid().toString());
+                for (TmpName name : names) {
+                    parentSystemStructureUuid = NameElementUtil.getParentSystemStructureUuid(name, holderTmpStructures);
+                    parentDeviceStructureUuid = NameElementUtil.getDeviceTypeUuid(name, holderTmpStructures);
                     nameElements.add(
                             new NameElementCommand(
-                                    name.getUuid(), parentSystemStructure, name.getDeviceTypeUuid(),
+                                    name.getUuid(), parentSystemStructureUuid, parentDeviceStructureUuid,
                                     name.getInstanceIndex(), name.getDescription()));
                 }
             }
@@ -844,12 +673,15 @@ public class NamesService {
         // validation outside method
         // transaction
         //     for each name element
-        //         update name - not latest
-        //         create name - latest, deleted
-        //         handle name element for created name
+        //         delete name (update)
+        //         create audit
+        //         handle name element for deleted name (updated)
         //     no notify
         //     return name elements for deleted names
 
+        // holder of valid content for system and device structures
+        HolderTmpStructures holderTmpStructures = new HolderTmpStructures(holderITmpRepositories);
+
         Date when = new Date();
         final List<NameElement> deletedNameElements = Lists.newArrayList();
         for (NameElementCommand nameElementCommand : nameElementCommands) {
@@ -857,36 +689,17 @@ public class NamesService {
             String comment = null;
 
             // update
-            Name name = holderIRepositories.nameRepository().findLatestByUuid(uuid.toString());
-            if (name != null) {
-                name.setLatest(Boolean.FALSE);
-                holderRepositories.nameRepository().updateName(name);
-            } else {
-                continue;
-            }
-
-            // create
-            name = new Name(uuid,
-                    name.getSystemGroupUuid(),
-                    name.getSystemUuid(),
-                    name.getSubsystemUuid(),
-                    name.getDeviceTypeUuid(),
-                    name.getInstanceIndex(), name.getConventionName(), name.getConventionNameEquivalence(), name.getDescription(),
-                    Status.APPROVED, Boolean.TRUE, Boolean.TRUE,
-                    when, username, comment);
-            holderRepositories.nameRepository().createName(name);
-
-            // update tmp
             // create audit
-            // <TMP>
             TmpName tmpName = holderITmpRepositories.nameRepository().findByUuid(uuid.toString());
+            if (tmpName == null) {
+                continue;
+            }
             tmpName.setDeleted(Boolean.TRUE);
-            tmpName.setAttributesRequested(when, username, null);
+            tmpName.setAttributesRequested(when, username, comment);
             holderTmpRepositories.nameRepository().updateName(tmpName);
             holderTmpRepositories.auditNameRepository().createAuditName(new TmpAuditName(TextUtil.DELETE, tmpName));
-            // </TMP>
 
-            NameElement deletedNameElement = NameElementUtil.getNameElement(name);
+            NameElement deletedNameElement = NameElementUtil.getNameElement(tmpName, holderTmpStructures);
             deletedNameElements.add(deletedNameElement);
 
             if (LOGGER.isLoggable(Level.FINER)) {
@@ -905,64 +718,61 @@ public class NamesService {
     }
 
     @Transactional(propagation = Propagation.MANDATORY)
-    public List<NameElement> deleteNames(Structure structure, String username) {
+    public List<NameElement> deleteNames(TmpStructure structure, String username, HolderTmpStructures holderTmpStructures) {
         // validation outside method
         // transaction
         //     support a current transaction, throw an exception if none exists
         //     find out names referenced by structure
-        //         by system group
-        //         by system
-        //         by subsystem
-        //         by device type
-        //     delete names
+        //     prepare name element commands
+        //     delete names (update)
         //     no notify
-        //     return name elements for deleted names
+        //     return name elements for deleted names (updated)
 
         List<NameElement> deletedNameElements = Lists.newArrayList();
         if (structure != null) {
-            List<Name> names = null;
+            List<TmpName> names = null;
             List<NameElementCommand> nameElements = Lists.newArrayList();
-            UUID parentSystemStructure = null;
-
-            if (structure instanceof SystemGroup) {
-                // find
-                // prepare
-                names = holderIRepositories.nameRepository().findLatestNotDeletedBySystemGroupUuid(structure.getUuid().toString());
-                for (Name name : names) {
+            UUID parentSystemStructureUuid = null;
+            UUID parentDeviceStructureUuid = null;
+
+            if (structure instanceof TmpSystemGroup) {
+                names = holderITmpRepositories.nameRepository().findNotDeletedBySystemGroupUuid(structure.getUuid().toString());
+                for (TmpName name : names) {
+                    parentSystemStructureUuid = NameElementUtil.getSystemGroupUuid(name, holderTmpStructures);
+                    parentDeviceStructureUuid = NameElementUtil.getDeviceTypeUuid(name, holderTmpStructures);
                     nameElements.add(
                             new NameElementCommand(
-                                    name.getUuid(), name.getSubsystemUuid(), name.getDeviceTypeUuid(),
+                                    name.getUuid(), parentSystemStructureUuid, parentDeviceStructureUuid,
                                     name.getInstanceIndex(), name.getDescription()));
                 }
-            } else if (structure instanceof System) {
-                // find
-                // prepare
-                names = holderIRepositories.nameRepository().findLatestNotDeletedBySystemUuid(structure.getUuid().toString());
-                for (Name name : names) {
+            } else if (structure instanceof TmpSystem) {
+                names = holderITmpRepositories.nameRepository().findNotDeletedBySystemUuid(structure.getUuid().toString());
+                for (TmpName name : names) {
+                    parentSystemStructureUuid = NameElementUtil.getSystemUuid(name, holderTmpStructures);
+                    parentDeviceStructureUuid = NameElementUtil.getDeviceTypeUuid(name, holderTmpStructures);
                     nameElements.add(
                             new NameElementCommand(
-                                    name.getUuid(), name.getSubsystemUuid(), name.getDeviceTypeUuid(),
+                                    name.getUuid(), parentSystemStructureUuid, parentDeviceStructureUuid,
                                     name.getInstanceIndex(), name.getDescription()));
                 }
-            } else if (structure instanceof Subsystem) {
-                // find
-                // prepare
-                names = holderIRepositories.nameRepository().findLatestNotDeletedBySubsystemUuid(structure.getUuid().toString());
-                for (Name name : names) {
+            } else if (structure instanceof TmpSubsystem) {
+                names = holderITmpRepositories.nameRepository().findNotDeletedBySubsystemUuid(structure.getUuid().toString());
+                for (TmpName name : names) {
+                    parentSystemStructureUuid = NameElementUtil.getSubsystemUuid(name, holderTmpStructures);
+                    parentDeviceStructureUuid = NameElementUtil.getDeviceTypeUuid(name, holderTmpStructures);
                     nameElements.add(
                             new NameElementCommand(
-                                    name.getUuid(), name.getSubsystemUuid(), name.getDeviceTypeUuid(),
+                                    name.getUuid(), parentSystemStructureUuid, parentDeviceStructureUuid,
                                     name.getInstanceIndex(), name.getDescription()));
                 }
-            } else if (structure instanceof DeviceType) {
-                // find
-                // prepare
-                names = holderIRepositories.nameRepository().findLatestNotDeletedByDeviceTypeUuid(structure.getUuid().toString());
-                for (Name name : names) {
-                    parentSystemStructure = NameUtil.getParentSystemStructure(name);
+            } else if (structure instanceof TmpDeviceType) {
+                names = holderITmpRepositories.nameRepository().findNotDeletedByDeviceTypeUuid(structure.getUuid().toString());
+                for (TmpName name : names) {
+                    parentSystemStructureUuid = NameElementUtil.getParentSystemStructureUuid(name, holderTmpStructures);
+                    parentDeviceStructureUuid = NameElementUtil.getDeviceTypeUuid(name, holderTmpStructures);
                     nameElements.add(
                             new NameElementCommand(
-                                    name.getUuid(), parentSystemStructure, name.getDeviceTypeUuid(),
+                                    name.getUuid(), parentSystemStructureUuid, parentDeviceStructureUuid,
                                     name.getInstanceIndex(), name.getDescription()));
                 }
             }
diff --git a/src/main/java/org/openepics/names/service/StructuresService.java b/src/main/java/org/openepics/names/service/StructuresService.java
index a837cc2f..9116323e 100644
--- a/src/main/java/org/openepics/names/service/StructuresService.java
+++ b/src/main/java/org/openepics/names/service/StructuresService.java
@@ -25,26 +25,6 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.apache.commons.lang3.StringUtils;
-import org.openepics.names.repository.DeviceGroupRepository;
-import org.openepics.names.repository.DeviceTypeRepository;
-import org.openepics.names.repository.DisciplineRepository;
-import org.openepics.names.repository.IDeviceGroupRepository;
-import org.openepics.names.repository.IDeviceTypeRepository;
-import org.openepics.names.repository.IDisciplineRepository;
-import org.openepics.names.repository.INameRepository;
-import org.openepics.names.repository.ISubsystemRepository;
-import org.openepics.names.repository.ISystemGroupRepository;
-import org.openepics.names.repository.ISystemRepository;
-import org.openepics.names.repository.NameRepository;
-import org.openepics.names.repository.SubsystemRepository;
-import org.openepics.names.repository.SystemGroupRepository;
-import org.openepics.names.repository.SystemRepository;
-import org.openepics.names.repository.model.DeviceGroup;
-import org.openepics.names.repository.model.DeviceType;
-import org.openepics.names.repository.model.Discipline;
-import org.openepics.names.repository.model.Subsystem;
-import org.openepics.names.repository.model.System;
-import org.openepics.names.repository.model.SystemGroup;
 import org.openepics.names.repository.model.tmp.TmpAuditStructure;
 import org.openepics.names.repository.model.tmp.TmpDeviceGroup;
 import org.openepics.names.repository.model.tmp.TmpDeviceType;
@@ -76,10 +56,7 @@ import org.openepics.names.rest.beans.element.StructureElement;
 import org.openepics.names.rest.beans.element.StructureElementCommand;
 import org.openepics.names.rest.beans.response.ResponsePageStructureElements;
 import org.openepics.names.util.EssNamingConvention;
-import org.openepics.names.util.HolderIRepositories;
 import org.openepics.names.util.HolderITmpRepositories;
-import org.openepics.names.util.HolderRepositories;
-import org.openepics.names.util.HolderStructures;
 import org.openepics.names.util.HolderTmpRepositories;
 import org.openepics.names.util.HolderTmpStructures;
 import org.openepics.names.util.StructureChoice;
@@ -104,12 +81,11 @@ import com.google.common.collect.Lists;
 public class StructuresService {
 
     // note
-    //     holder
-    //         HolderIRepositories and HolderSystemDeviceStructure may or may not be used for preparation of what to return
-    //     latest
-    //         automatically not show structures that do not come into play
-    //         = automatically exclude (approved and not latest)
-    //         otherwise refer to history
+    //     default
+    //         active means valid not deleted
+    //         obsolete values are not shown unless history is requested
+    //     sorting
+    //         sorting not applicable when multiple repositories are queried in same method
     //     structurecommand
     //         cud - create update delete
 
@@ -125,8 +101,6 @@ public class StructuresService {
     private DisciplineService disciplineService;
     private DeviceGroupService deviceGroupService;
     private DeviceTypeService deviceTypeService;
-    private HolderIRepositories holderIRepositories;
-    private HolderRepositories holderRepositories;
     private HolderITmpRepositories holderITmpRepositories;
     private HolderTmpRepositories holderTmpRepositories;
 
@@ -139,20 +113,6 @@ public class StructuresService {
             DisciplineService disciplineService,
             DeviceGroupService deviceGroupService,
             DeviceTypeService deviceTypeService,
-            INameRepository iNameRepository,
-            ISystemGroupRepository iSystemGroupRepository,
-            ISystemRepository iSystemRepository,
-            ISubsystemRepository iSubsystemRepository,
-            IDisciplineRepository iDisciplineRepository,
-            IDeviceGroupRepository iDeviceGroupRepository,
-            IDeviceTypeRepository iDeviceTypeRepository,
-            NameRepository nameRepository,
-            SystemGroupRepository systemGroupRepository,
-            SystemRepository systemRepository,
-            SubsystemRepository subsystemRepository,
-            DisciplineRepository disciplineRepository,
-            DeviceGroupRepository deviceGroupRepository,
-            DeviceTypeRepository deviceTypeRepository,
             ITmpNameRepository iTmpNameRepository,
             ITmpSystemGroupRepository iTmpSystemGroupRepository,
             ITmpSystemRepository iTmpSystemRepository,
@@ -180,22 +140,6 @@ public class StructuresService {
         this.disciplineService = disciplineService;
         this.deviceGroupService = deviceGroupService;
         this.deviceTypeService = deviceTypeService;
-        this.holderIRepositories = new HolderIRepositories(
-                iNameRepository,
-                iSystemGroupRepository,
-                iSystemRepository,
-                iSubsystemRepository,
-                iDisciplineRepository,
-                iDeviceGroupRepository,
-                iDeviceTypeRepository);
-        this.holderRepositories = new HolderRepositories(
-                nameRepository,
-                systemGroupRepository,
-                systemRepository,
-                subsystemRepository,
-                disciplineRepository,
-                deviceGroupRepository,
-                deviceTypeRepository);
         this.holderITmpRepositories = new HolderITmpRepositories(
                 iTmpNameRepository,
                 iTmpSystemGroupRepository,
@@ -231,7 +175,6 @@ public class StructuresService {
         //     return structure elements for created structures
 
         // holder of valid content for system and device structures
-        HolderStructures holderStructures = new HolderStructures(holderIRepositories);
         HolderTmpStructures holderTmpStructures = new HolderTmpStructures(holderITmpRepositories);
 
         Date when = new Date();
@@ -242,17 +185,17 @@ public class StructuresService {
             StructureElementNotification structureElementNotification = null;
 
             if (Type.SYSTEMGROUP.equals(type)) {
-                structureElementNotification = systemGroupService.createStructure(structureElement, when, username, namingConvention, holderStructures, holderTmpStructures);
+                structureElementNotification = systemGroupService.createStructure(structureElement, when, username, namingConvention, holderTmpStructures);
             } else if (Type.SYSTEM.equals(type)) {
-                structureElementNotification = systemService.createStructure(structureElement, when, username, namingConvention, holderStructures, holderTmpStructures);
+                structureElementNotification = systemService.createStructure(structureElement, when, username, namingConvention, holderTmpStructures);
             } else if (Type.SUBSYSTEM.equals(type)) {
-                structureElementNotification = subsystemService.createStructure(structureElement, when, username, namingConvention, holderStructures, holderTmpStructures);
+                structureElementNotification = subsystemService.createStructure(structureElement, when, username, namingConvention, holderTmpStructures);
             } else if (Type.DISCIPLINE.equals(type)) {
-                structureElementNotification = disciplineService.createStructure(structureElement, when, username, namingConvention, holderStructures, holderTmpStructures);
+                structureElementNotification = disciplineService.createStructure(structureElement, when, username, namingConvention, holderTmpStructures);
             } else if (Type.DEVICEGROUP.equals(type)) {
-                structureElementNotification = deviceGroupService.createStructure(structureElement, when, username, namingConvention, holderStructures, holderTmpStructures);
+                structureElementNotification = deviceGroupService.createStructure(structureElement, when, username, namingConvention, holderTmpStructures);
             } else if (Type.DEVICETYPE.equals(type)) {
-                structureElementNotification = deviceTypeService.createStructure(structureElement, when, username, namingConvention, holderStructures, holderTmpStructures);
+                structureElementNotification = deviceTypeService.createStructure(structureElement, when, username, namingConvention, holderTmpStructures);
             } else {
                 continue;
             }
@@ -320,20 +263,7 @@ public class StructuresService {
         }
 
         // holder of valid content for system and device structures
-        HolderStructures holderStructures = new HolderStructures(holderIRepositories);
-
-        // one structure entry will give one or two structure elements
-        //     depends on history or not - history may give one or two elements, if not history then one element
-        //     history affects totalCount, sorting, pagination
-        //         additional effects (entries) if type is not given
-        //         totalCount = Long.valueOf(structureElements.size())
-        //         this affects result
-        //         -->
-        //         actions to mitigate / handle
-        //             have type as required parameter
-        //             have pagination for history in StructuresService and not in Repository classes (!)
-        //                 after conversion to List<StructureElement>
-        //             analyse and decide on sorting for history
+        HolderTmpStructures holderTmpStructures = new HolderTmpStructures(holderITmpRepositories);
 
         List<StructureElement> structureElements = Lists.newArrayList();
 
@@ -342,221 +272,69 @@ public class StructuresService {
         // pagination after queries since type is not required
 
         if (StringUtils.isEmpty(parent) && (Type.SYSTEMGROUP.equals(type) || type == null)) {
-            List<SystemGroup> systemGroups = null;
-            List<TmpSystemGroup> tmpSystemGroups = null;
-            Long tmpSystemGroupCount = null;
-            List<TmpAuditStructure> tmpAuditStructures = null;
-            Long tmpAuditStructuresCount = null;
             if (Boolean.TRUE.equals(includeHistory)) {
-                systemGroups = holderRepositories.systemGroupRepository().readSystemGroupsHistory(uuid, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc);
-
-                // <TMP>
-                LOGGER.log(Level.INFO, "readStructures, systemGroups.size: " + systemGroups.size());
-                tmpSystemGroups = holderTmpRepositories.systemGroupRepository().readSystemGroups(deleted, uuid, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc, null, null);
-                tmpSystemGroupCount = holderTmpRepositories.systemGroupRepository().countSystemGroups(deleted, uuid, mnemonic, null, mnemonicPath, description, who);
-                tmpAuditStructures = holderTmpRepositories.auditStructureRepository().readTmpAuditStructures(null, uuid, null, null);
-                tmpAuditStructuresCount = holderTmpRepositories.auditStructureRepository().countTmpAuditStructures(null, uuid);
-                LOGGER.log(Level.INFO, "readStructures,      tmpSystemGroups.size:    " + tmpSystemGroups.size());
-                LOGGER.log(Level.INFO, "readStructures,      tmpSystemGroupCount:     " + tmpSystemGroupCount);
-                LOGGER.log(Level.INFO, "readStructures,      tmpAuditStructures.size: " + tmpAuditStructures.size());
-                LOGGER.log(Level.INFO, "readStructures,      tmpAuditStructuresCount: " + tmpAuditStructuresCount);
-                // </TMP>
+                List<TmpAuditStructure> tmpAuditStructures = holderTmpRepositories.auditStructureRepository().readTmpAuditStructures(null, uuid, null, null);
+                structureElements.addAll(StructureElementUtil.getStructureElementsForAuditStructures(tmpAuditStructures, holderTmpStructures, structureChoice));
             } else {
-                systemGroups = holderRepositories.systemGroupRepository().readSystemGroups(deleted, uuid, mnemonic, null, mnemonicPath, description, who, includeHistory, orderBy, isAsc, null, null);
-
-                // <TMP>
-                LOGGER.log(Level.INFO, "readStructures, systemGroups.size: " + systemGroups.size());
-                tmpSystemGroups = holderTmpRepositories.systemGroupRepository().readSystemGroups(deleted, uuid, mnemonicPath, mnemonic, mnemonicPath, description, who, orderBy, isAsc, null, null);
-                tmpSystemGroupCount = holderTmpRepositories.systemGroupRepository().countSystemGroups(deleted, uuid, mnemonicPath, mnemonic, mnemonicPath, description, who);
-                LOGGER.log(Level.INFO, "readStructures,      tmpSystemGroups.size:    " + tmpSystemGroups.size());
-                LOGGER.log(Level.INFO, "readStructures,      tmpSystemGroupCount:     " + tmpSystemGroupCount);
-                // </TMP>
+                List<TmpSystemGroup> tmpSystemGroups = holderTmpRepositories.systemGroupRepository().readSystemGroups(deleted, uuid, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc, null, null);
+                structureElements.addAll(StructureElementUtil.getStructureElementsForSystemGroups(tmpSystemGroups, holderTmpStructures, structureChoice));
             }
-            structureElements.addAll(StructureElementUtil.getStructureElementsForSystemGroups(systemGroups, holderStructures, structureChoice));
         }
 
         if (Type.SYSTEM.equals(type) || type == null) {
-            List<System> systems = null;
-            List<TmpSystem> tmpSystems = null;
-            Long tmpSystemCount = null;
-            List<TmpAuditStructure> tmpAuditStructures = null;
-            Long tmpAuditStructuresCount = null;
             if (Boolean.TRUE.equals(includeHistory)) {
-                systems = holderRepositories.systemRepository().readSystemsHistory(uuid, parent, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc);
-
-                // <TMP>
-                LOGGER.log(Level.INFO, "readStructures, systems.size:      " + systems.size());
-                tmpSystems = holderTmpRepositories.systemRepository().readSystems(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc, null, null);
-                tmpSystemCount = holderTmpRepositories.systemRepository().countSystems(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who);
-                tmpAuditStructures = holderTmpRepositories.auditStructureRepository().readTmpAuditStructures(null, uuid, null, null);
-                tmpAuditStructuresCount = holderTmpRepositories.auditStructureRepository().countTmpAuditStructures(null, uuid);
-                LOGGER.log(Level.INFO, "readStructures,      tmpSystems.size:         " + tmpSystems.size());
-                LOGGER.log(Level.INFO, "readStructures,      tmpSystemCount:          " + tmpSystemCount);
-                LOGGER.log(Level.INFO, "readStructures,      tmpAuditStructures.size: " + tmpAuditStructures.size());
-                LOGGER.log(Level.INFO, "readStructures,      tmpAuditStructuresCount: " + tmpAuditStructuresCount);
-                // </TMP>
+                List<TmpAuditStructure> tmpAuditStructures = holderTmpRepositories.auditStructureRepository().readTmpAuditStructures(null, uuid, null, null);
+                structureElements.addAll(StructureElementUtil.getStructureElementsForAuditStructures(tmpAuditStructures, holderTmpStructures, structureChoice));
             } else {
-                systems = holderRepositories.systemRepository().readSystems(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who, includeHistory, orderBy, isAsc, null, null);
-
-                // <TMP>
-                LOGGER.log(Level.INFO, "readStructures, systems.size:      " + systems.size());
-                tmpSystems = holderTmpRepositories.systemRepository().readSystems(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc, null, null);
-                tmpSystemCount = holderTmpRepositories.systemRepository().countSystems(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who);
-                LOGGER.log(Level.INFO, "readStructures,      tmpSystems.size:         " + tmpSystems.size());
-                LOGGER.log(Level.INFO, "readStructures,      tmpSystemCount:          " + tmpSystemCount);
-                // </TMP>
+                List<TmpSystem> tmpSystems = holderTmpRepositories.systemRepository().readSystems(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc, null, null);
+                structureElements.addAll(StructureElementUtil.getStructureElementsForSystems(tmpSystems, holderTmpStructures, structureChoice));
             }
-            structureElements.addAll(StructureElementUtil.getStructureElementsForSystems(systems, holderStructures, structureChoice));
         }
 
         if (Type.SUBSYSTEM.equals(type) || type == null) {
-            List<Subsystem> subsystems = null;
-            List<TmpSubsystem> tmpSubsystems = null;
-            Long tmpSubsystemCount = null;
-            List<TmpAuditStructure> tmpAuditStructures = null;
-            Long tmpAuditStructuresCount = null;
             if (Boolean.TRUE.equals(includeHistory)) {
-                subsystems = holderRepositories.subsystemRepository().readSubsystemsHistory(uuid, parent, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc);
-
-                // <TMP>
-                LOGGER.log(Level.INFO, "readStructures, subsystems.size:   " + subsystems.size());
-                tmpSubsystems = holderTmpRepositories.subsystemRepository().readSubsystems(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc, null, null);
-                tmpSubsystemCount = holderTmpRepositories.subsystemRepository().countSubsystems(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who);
-                tmpAuditStructures = holderTmpRepositories.auditStructureRepository().readTmpAuditStructures(null, uuid, null, null);
-                tmpAuditStructuresCount = holderTmpRepositories.auditStructureRepository().countTmpAuditStructures(null, uuid);
-                LOGGER.log(Level.INFO, "readStructures,      tmpSubsystems.size:      " + tmpSubsystems.size());
-                LOGGER.log(Level.INFO, "readStructures,      tmpSubsystemCount:       " + tmpSubsystemCount);
-                LOGGER.log(Level.INFO, "readStructures,      tmpAuditStructures.size: " + tmpAuditStructures.size());
-                LOGGER.log(Level.INFO, "readStructures,      tmpAuditStructuresCount: " + tmpAuditStructuresCount);
-                // </TMP>
+                List<TmpAuditStructure> tmpAuditStructures = holderTmpRepositories.auditStructureRepository().readTmpAuditStructures(null, uuid, null, null);
+                structureElements.addAll(StructureElementUtil.getStructureElementsForAuditStructures(tmpAuditStructures, holderTmpStructures, structureChoice));
             } else {
-                subsystems = holderRepositories.subsystemRepository().readSubsystems(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who, includeHistory, orderBy, isAsc, null, null);
-
-                // <TMP>
-                LOGGER.log(Level.INFO, "readStructures, subsystems.size:   " + subsystems.size());
-                tmpSubsystems = holderTmpRepositories.subsystemRepository().readSubsystems(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc, null, null);
-                tmpSubsystemCount = holderTmpRepositories.subsystemRepository().countSubsystems(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who);
-                LOGGER.log(Level.INFO, "readStructures,      tmpSubsystems.size:      " + tmpSubsystems.size());
-                LOGGER.log(Level.INFO, "readStructures,      tmpSubsystemCount:       " + tmpSubsystemCount);
-                // </TMP>
+                List<TmpSubsystem> tmpSubsystems = holderTmpRepositories.subsystemRepository().readSubsystems(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc, null, null);
+                structureElements.addAll(StructureElementUtil.getStructureElementsForSubsystems(tmpSubsystems, holderTmpStructures, structureChoice));
             }
-            structureElements.addAll(StructureElementUtil.getStructureElementsForSubsystems(subsystems, holderStructures, structureChoice));
         }
 
         if (StringUtils.isEmpty(parent) && (Type.DISCIPLINE.equals(type) || type == null)) {
-            List<Discipline> disciplines = null;
-            List<TmpDiscipline> tmpDisciplines = null;
-            Long tmpDisciplineCount = null;
-            List<TmpAuditStructure> tmpAuditStructures = null;
-            Long tmpAuditStructuresCount = null;
             if (Boolean.TRUE.equals(includeHistory)) {
-                disciplines = holderRepositories.disciplineRepository().readDisciplinesHistory(uuid, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc);
-
-                // <TMP>
-                LOGGER.log(Level.INFO, "readStructures, disciplines.size:  " + disciplines.size());
-                tmpDisciplines = holderTmpRepositories.disciplineRepository().readDisciplines(deleted, uuid, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc, null, null);
-                tmpDisciplineCount = holderTmpRepositories.disciplineRepository().countDisciplines(deleted, uuid, mnemonic, null, mnemonicPath, description, who);
-                tmpAuditStructures = holderTmpRepositories.auditStructureRepository().readTmpAuditStructures(null, uuid, null, null);
-                tmpAuditStructuresCount = holderTmpRepositories.auditStructureRepository().countTmpAuditStructures(null, uuid);
-                LOGGER.log(Level.INFO, "readStructures,      tmpDisciplines.size:     " + tmpDisciplines.size());
-                LOGGER.log(Level.INFO, "readStructures,      tmpDisciplineCount:      " + tmpDisciplineCount);
-                LOGGER.log(Level.INFO, "readStructures,      tmpAuditStructures.size: " + tmpAuditStructures.size());
-                LOGGER.log(Level.INFO, "readStructures,      tmpAuditStructuresCount: " + tmpAuditStructuresCount);
-                // </TMP>
+                List<TmpAuditStructure> tmpAuditStructures = holderTmpRepositories.auditStructureRepository().readTmpAuditStructures(null, uuid, null, null);
+                structureElements.addAll(StructureElementUtil.getStructureElementsForAuditStructures(tmpAuditStructures, holderTmpStructures, structureChoice));
             } else {
-                disciplines = holderRepositories.disciplineRepository().readDisciplines(deleted, uuid, mnemonic, null, mnemonicPath, description, who, includeHistory, orderBy, isAsc, null, null);
-
-                // <TMP>
-                LOGGER.log(Level.INFO, "readStructures, disciplines.size:  " + disciplines.size());
-                tmpDisciplines = holderTmpRepositories.disciplineRepository().readDisciplines(deleted, uuid, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc, null, null);
-                tmpDisciplineCount = holderTmpRepositories.disciplineRepository().countDisciplines(deleted, uuid, mnemonic, null, mnemonicPath, description, who);
-                LOGGER.log(Level.INFO, "readStructures,      tmpDisciplines.size:     " + tmpDisciplines.size());
-                LOGGER.log(Level.INFO, "readStructures,      tmpDisciplineCount:      " + tmpDisciplineCount);
-                // </TMP>
+                List<TmpDiscipline> tmpDisciplines = holderTmpRepositories.disciplineRepository().readDisciplines(deleted, uuid, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc, null, null);
+                structureElements.addAll(StructureElementUtil.getStructureElementsForDisciplines(tmpDisciplines, holderTmpStructures, structureChoice));
             }
-            structureElements.addAll(StructureElementUtil.getStructureElementsForDisciplines(disciplines, holderStructures, structureChoice));
         }
 
         if (Type.DEVICEGROUP.equals(type) || type == null) {
-            List<DeviceGroup> deviceGroups = null;
-            List<TmpDeviceGroup> tmpDeviceGroups = null;
-            Long tmpDeviceGroupCount = null;
-            List<TmpAuditStructure> tmpAuditStructures = null;
-            Long tmpAuditStructuresCount = null;
             if (Boolean.TRUE.equals(includeHistory)) {
-                deviceGroups = holderRepositories.deviceGroupRepository().readDeviceGroupsHistory(uuid, parent, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc);
-
-                // <TMP>
-                LOGGER.log(Level.INFO, "readStructures, deviceGroups.size: " + deviceGroups.size());
-                tmpDeviceGroups = holderTmpRepositories.deviceGroupRepository().readDeviceGroups(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc, null, null);
-                tmpDeviceGroupCount = holderTmpRepositories.deviceGroupRepository().countDeviceGroups(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who);
-                tmpAuditStructures = holderTmpRepositories.auditStructureRepository().readTmpAuditStructures(null, uuid, null, null);
-                tmpAuditStructuresCount = holderTmpRepositories.auditStructureRepository().countTmpAuditStructures(null, uuid);
-                LOGGER.log(Level.INFO, "readStructures,      tmpDeviceGroups.size:    " + tmpDeviceGroups.size());
-                LOGGER.log(Level.INFO, "readStructures,      tmpDeviceGroupCount:     " + tmpDeviceGroupCount);
-                LOGGER.log(Level.INFO, "readStructures,      tmpAuditStructures.size: " + tmpAuditStructures.size());
-                LOGGER.log(Level.INFO, "readStructures,      tmpAuditStructuresCount: " + tmpAuditStructuresCount);
-                // </TMP>
+                List<TmpAuditStructure> tmpAuditStructures = holderTmpRepositories.auditStructureRepository().readTmpAuditStructures(null, uuid, null, null);
+                structureElements.addAll(StructureElementUtil.getStructureElementsForAuditStructures(tmpAuditStructures, holderTmpStructures, structureChoice));
             } else {
-                deviceGroups = holderRepositories.deviceGroupRepository().readDeviceGroups(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who, includeHistory, orderBy, isAsc, null, null);
-
-                // <TMP>
-                LOGGER.log(Level.INFO, "readStructures, deviceGroups.size: " + deviceGroups.size());
-                tmpDeviceGroups = holderTmpRepositories.deviceGroupRepository().readDeviceGroups(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc, null, null);
-                tmpDeviceGroupCount = holderTmpRepositories.deviceGroupRepository().countDeviceGroups(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who);
-                LOGGER.log(Level.INFO, "readStructures,      tmpDeviceGroups.size:    " + tmpDeviceGroups.size());
-                LOGGER.log(Level.INFO, "readStructures,      tmpDeviceGroupCount:     " + tmpDeviceGroupCount);
-                // </TMP>
+                List<TmpDeviceGroup> tmpDeviceGroups = holderTmpRepositories.deviceGroupRepository().readDeviceGroups(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc, null, null);
+                structureElements.addAll(StructureElementUtil.getStructureElementsForDeviceGroups(tmpDeviceGroups, holderTmpStructures, structureChoice));
             }
-            structureElements.addAll(StructureElementUtil.getStructureElementsForDeviceGroups(deviceGroups, holderStructures, structureChoice));
         }
 
         if (Type.DEVICETYPE.equals(type) || type == null) {
-            List<DeviceType> deviceTypes = null;
-            List<TmpDeviceType> tmpDeviceTypes = null;
-            Long tmpDeviceTypeCount = null;
-            List<TmpAuditStructure> tmpAuditStructures = null;
-            Long tmpAuditStructuresCount = null;
             if (Boolean.TRUE.equals(includeHistory)) {
-                deviceTypes = holderRepositories.deviceTypeRepository().readDeviceTypesHistory(uuid, parent, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc);
-
-                // <TMP>
-                LOGGER.log(Level.INFO, "readStructures, deviceTypes.size:  " + deviceTypes.size());
-                tmpDeviceTypes = holderTmpRepositories.deviceTypeRepository().readDeviceTypes(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc, null, null);
-                tmpDeviceTypeCount = holderTmpRepositories.deviceTypeRepository().countDeviceTypes(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who);
-                tmpAuditStructures = holderTmpRepositories.auditStructureRepository().readTmpAuditStructures(null, uuid, null, null);
-                tmpAuditStructuresCount = holderTmpRepositories.auditStructureRepository().countTmpAuditStructures(null, uuid);
-                LOGGER.log(Level.INFO, "readStructures,      tmpDeviceTypes.size:     " + tmpDeviceTypes.size());
-                LOGGER.log(Level.INFO, "readStructures,      tmpDeviceTypeCount:      " + tmpDeviceTypeCount);
-                LOGGER.log(Level.INFO, "readStructures,      tmpAuditStructures.size: " + tmpAuditStructures.size());
-                LOGGER.log(Level.INFO, "readStructures,      tmpAuditStructuresCount: " + tmpAuditStructuresCount);
-                // </TMP>
+                List<TmpAuditStructure> tmpAuditStructures = holderTmpRepositories.auditStructureRepository().readTmpAuditStructures(null, uuid, null, null);
+                structureElements.addAll(StructureElementUtil.getStructureElementsForAuditStructures(tmpAuditStructures, holderTmpStructures, structureChoice));
             } else {
-                deviceTypes = holderRepositories.deviceTypeRepository().readDeviceTypes(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who, includeHistory, orderBy, isAsc, null, null);
-
-                // <TMP>
-                LOGGER.log(Level.INFO, "readStructures, deviceTypes.size:  " + deviceTypes.size());
-                tmpDeviceTypes = holderTmpRepositories.deviceTypeRepository().readDeviceTypes(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc, null, null);
-                tmpDeviceTypeCount = holderTmpRepositories.deviceTypeRepository().countDeviceTypes(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who);
-                LOGGER.log(Level.INFO, "readStructures,      tmpDeviceTypes.size:     " + tmpDeviceTypes.size());
-                LOGGER.log(Level.INFO, "readStructures,      tmpDeviceTypeCount:      " + tmpDeviceTypeCount);
-                // </TMP>
+                List<TmpDeviceType> tmpDeviceTypes = holderTmpRepositories.deviceTypeRepository().readDeviceTypes(deleted, uuid, parent, mnemonic, null, mnemonicPath, description, who, orderBy, isAsc, null, null);
+                structureElements.addAll(StructureElementUtil.getStructureElementsForDeviceTypes(tmpDeviceTypes, holderTmpStructures, structureChoice));
             }
-            structureElements.addAll(StructureElementUtil.getStructureElementsForDeviceTypes(deviceTypes, holderStructures, structureChoice));
         }
 
-        // <TMP>
-        LOGGER.log(Level.INFO, "readStructures, structureElements.size: " + structureElements.size());
-        // </TMP>
         // pagination for normal read and history
         Long totalCount = Long.valueOf(structureElements.size());
         structureElements = paginate(structureElements, offset, limit);
 
-        // <TMP>
-        LOGGER.log(Level.INFO, "readStructures, structureElements.size: " + structureElements.size());
-        LOGGER.log(Level.INFO, "readStructures, totalCount:             " + totalCount);
-        // </TMP>
-
         ResponsePageStructureElements response = new ResponsePageStructureElements(structureElements, totalCount, structureElements.size(), offset, limit);
         LOGGER.log(Level.FINE,
                 () -> MessageFormat.format(
@@ -588,7 +366,7 @@ public class StructuresService {
             Boolean deleted,
             FieldStructure orderBy, Boolean isAsc, Integer offset, Integer limit) {
         // validation outside method
-        // read structure latest by uuid for type
+        // read structure by uuid for type
         // return structure elements for structures
 
         if (LOGGER.isLoggable(Level.FINE)) {
@@ -612,10 +390,6 @@ public class StructuresService {
         structureElements.addAll(responseDiscipline.getList());
         structureElements.addAll(responseDeviceGroup.getList());
 
-        // <TMP>
-        LOGGER.log(Level.INFO, "readStructuresChildren, structureElements.size: " + structureElements.size());
-        // </TMP>
-
         // uuid is in max one kind of structure
         return new ResponsePageStructureElements(structureElements, Long.valueOf(structureElements.size()), structureElements.size(), offset, limit);
     }
@@ -651,11 +425,6 @@ public class StructuresService {
         response = response.getTotalCount() == 0 ? readStructures(Type.DEVICEGROUP, null, uuid, null, null, null, null, null, Boolean.TRUE, FieldStructure.WHEN, Boolean.TRUE, offset, limit, StructureChoice.HISTORY) : response;
         response = response.getTotalCount() == 0 ? readStructures(Type.DEVICETYPE,  null, uuid, null, null, null, null, null, Boolean.TRUE, FieldStructure.WHEN, Boolean.TRUE, offset, limit, StructureChoice.HISTORY) : response;
 
-        // <TMP>
-        LOGGER.log(Level.INFO, "readStructuresHistory, response.getListSize:   " + response.getListSize());
-        LOGGER.log(Level.INFO, "readStructuresHistory, response.getTotalCount: " + response.getTotalCount());
-        // </TMP>
-
         return response;
     }
 
@@ -671,21 +440,21 @@ public class StructuresService {
         }
 
         if (Type.SYSTEMGROUP.equals(type)) {
-            List<SystemGroup> systemGroups = holderRepositories.systemGroupRepository().readSystemGroups(false, null, null, null, mnemonicPath, null, null);
+            List<TmpSystemGroup> systemGroups = holderTmpRepositories.systemGroupRepository().readSystemGroups(false, null, null, null, mnemonicPath, null, null);
             return !systemGroups.isEmpty();
         } else if (Type.SYSTEM.equals(type)) {
-            List<System> systems = holderRepositories.systemRepository().readSystems(false, null, null, null, null, mnemonicPath, null, null);
+            List<TmpSystem> systems = holderTmpRepositories.systemRepository().readSystems(false, null, null, null, null, mnemonicPath, null, null);
             return !systems.isEmpty();
         } else if (Type.SUBSYSTEM.equals(type)) {
-            List<Subsystem> subsystems = holderRepositories.subsystemRepository().readSubsystems(false, null, null, null, null, mnemonicPath, null, null);
+            List<TmpSubsystem> subsystems = holderTmpRepositories.subsystemRepository().readSubsystems(false, null, null, null, null, mnemonicPath, null, null);
             return !subsystems.isEmpty();
         } else if (Type.DISCIPLINE.equals(type)) {
-            List<Discipline> disciplines = holderRepositories.disciplineRepository().readDisciplines(false, null, null, null, mnemonicPath, null, null);
+            List<TmpDiscipline> disciplines = holderTmpRepositories.disciplineRepository().readDisciplines(false, null, null, null, mnemonicPath, null, null);
             return !disciplines.isEmpty();
         } else if (Type.DEVICEGROUP.equals(type)) {
             return Boolean.FALSE;
         } else if (Type.DEVICETYPE.equals(type)) {
-            List<DeviceType> deviceTypes = holderRepositories.deviceTypeRepository().readDeviceTypes(false, null, null, null, null, mnemonicPath, null, null);
+            List<TmpDeviceType> deviceTypes = holderTmpRepositories.deviceTypeRepository().readDeviceTypes(false, null, null, null, null, mnemonicPath, null, null);
             return !deviceTypes.isEmpty();
         }
 
@@ -787,7 +556,6 @@ public class StructuresService {
         //     return structure elements for updated structures
 
         // holder of valid content for system and device structures
-        HolderStructures holderStructures = new HolderStructures(holderIRepositories);
         HolderTmpStructures holderTmpStructures = new HolderTmpStructures(holderITmpRepositories);
 
         Date when = new Date();
@@ -798,17 +566,17 @@ public class StructuresService {
             StructureElementNotification structureElementNotification = null;
 
             if (Type.SYSTEMGROUP.equals(type)) {
-                structureElementNotification = systemGroupService.updateStructure(structureElement, when, username, namingConvention, holderStructures, holderTmpStructures);
+                structureElementNotification = systemGroupService.updateStructure(structureElement, when, username, namingConvention, holderTmpStructures);
             } else if (Type.SYSTEM.equals(type)) {
-                structureElementNotification = systemService.updateStructure(structureElement, when, username, namingConvention, holderStructures, holderTmpStructures);
+                structureElementNotification = systemService.updateStructure(structureElement, when, username, namingConvention, holderTmpStructures);
             } else if (Type.SUBSYSTEM.equals(type)) {
-                structureElementNotification = subsystemService.updateStructure(structureElement, when, username, namingConvention, holderStructures, holderTmpStructures);
+                structureElementNotification = subsystemService.updateStructure(structureElement, when, username, namingConvention, holderTmpStructures);
             } else if (Type.DISCIPLINE.equals(type)) {
-                structureElementNotification = disciplineService.updateStructure(structureElement, when, username, namingConvention, holderStructures, holderTmpStructures);
+                structureElementNotification = disciplineService.updateStructure(structureElement, when, username, namingConvention, holderTmpStructures);
             } else if (Type.DEVICEGROUP.equals(type)) {
-                structureElementNotification = deviceGroupService.updateStructure(structureElement, when, username, namingConvention, holderStructures, holderTmpStructures);
+                structureElementNotification = deviceGroupService.updateStructure(structureElement, when, username, namingConvention, holderTmpStructures);
             } else if (Type.DEVICETYPE.equals(type)) {
-                structureElementNotification = deviceTypeService.updateStructure(structureElement, when, username, namingConvention, holderStructures, holderTmpStructures);
+                structureElementNotification = deviceTypeService.updateStructure(structureElement, when, username, namingConvention, holderTmpStructures);
             } else {
                 continue;
             }
@@ -851,7 +619,6 @@ public class StructuresService {
         //     return structure elements for deleted structures
 
         // holder of valid content for system and device structures
-        HolderStructures holderStructures = new HolderStructures(holderIRepositories);
         HolderTmpStructures holderTmpStructures = new HolderTmpStructures(holderITmpRepositories);
 
         Date when = new Date();
@@ -862,17 +629,17 @@ public class StructuresService {
             StructureElementNotification structureElementNotification = null;
 
             if (Type.SYSTEMGROUP.equals(type)) {
-                structureElementNotification = systemGroupService.deleteStructure(structureElement, when, username, holderStructures, holderTmpStructures);
+                structureElementNotification = systemGroupService.deleteStructure(structureElement, when, username, holderTmpStructures);
             } else if (Type.SYSTEM.equals(type)) {
-                structureElementNotification = systemService.deleteStructure(structureElement, when, username, holderStructures, holderTmpStructures);
+                structureElementNotification = systemService.deleteStructure(structureElement, when, username, holderTmpStructures);
             } else if (Type.SUBSYSTEM.equals(type)) {
-                structureElementNotification = subsystemService.deleteStructure(structureElement, when, username, holderStructures, holderTmpStructures);
+                structureElementNotification = subsystemService.deleteStructure(structureElement, when, username, holderTmpStructures);
             } else if (Type.DISCIPLINE.equals(type)) {
-                structureElementNotification = disciplineService.deleteStructure(structureElement, when, username, holderStructures, holderTmpStructures);
+                structureElementNotification = disciplineService.deleteStructure(structureElement, when, username, holderTmpStructures);
             } else if (Type.DEVICEGROUP.equals(type)) {
-                structureElementNotification = deviceGroupService.deleteStructure(structureElement, when, username, holderStructures, holderTmpStructures);
+                structureElementNotification = deviceGroupService.deleteStructure(structureElement, when, username, holderTmpStructures);
             } else if (Type.DEVICETYPE.equals(type)) {
-                structureElementNotification = deviceTypeService.deleteStructure(structureElement, when, username, holderStructures, holderTmpStructures);
+                structureElementNotification = deviceTypeService.deleteStructure(structureElement, when, username, holderTmpStructures);
             } else {
                 continue;
             }
diff --git a/src/main/java/org/openepics/names/service/SubsystemService.java b/src/main/java/org/openepics/names/service/SubsystemService.java
index 38b10a55..9fc8a4f3 100644
--- a/src/main/java/org/openepics/names/service/SubsystemService.java
+++ b/src/main/java/org/openepics/names/service/SubsystemService.java
@@ -20,16 +20,11 @@ package org.openepics.names.service;
 
 import java.text.MessageFormat;
 import java.util.Date;
-import java.util.List;
 import java.util.UUID;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.apache.commons.lang3.StringUtils;
-import org.openepics.names.repository.ISubsystemRepository;
-import org.openepics.names.repository.ISystemRepository;
-import org.openepics.names.repository.SubsystemRepository;
-import org.openepics.names.repository.model.Subsystem;
 import org.openepics.names.repository.model.tmp.TmpAuditStructure;
 import org.openepics.names.repository.model.tmp.TmpSubsystem;
 import org.openepics.names.repository.model.tmp.TmpSystem;
@@ -43,14 +38,12 @@ import org.openepics.names.rest.beans.Type;
 import org.openepics.names.rest.beans.element.NameElementCommand;
 import org.openepics.names.rest.beans.element.StructureElementCommand;
 import org.openepics.names.util.EssNamingConvention;
-import org.openepics.names.util.HolderStructures;
 import org.openepics.names.util.HolderTmpStructures;
 import org.openepics.names.util.StructureChoice;
 import org.openepics.names.util.StructureCommand;
 import org.openepics.names.util.StructureElementUtil;
 import org.openepics.names.util.StructureUtil;
 import org.openepics.names.util.TextUtil;
-import org.openepics.names.util.ValidateUtil;
 import org.openepics.names.util.notification.NotificationUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -68,8 +61,6 @@ public class SubsystemService {
     private static final Logger LOGGER = Logger.getLogger(SubsystemService.class.getName());
 
     private NamesService namesService;
-    private ISubsystemRepository iSubsystemRepository;
-    private SubsystemRepository subsystemRepository;
     private ITmpSystemRepository iTmpSystemRepository;
     private ITmpSubsystemRepository iTmpSubsystemRepository;
     private ITmpAuditStructureRepository iTmpAuditStructureRepository;
@@ -79,17 +70,12 @@ public class SubsystemService {
     @Autowired
     public SubsystemService(
             NamesService namesService,
-            ISystemRepository iSystemRepository,
-            ISubsystemRepository iSubsystemRepository,
-            SubsystemRepository subsystemRepository,
             ITmpSystemRepository iTmpSystemRepository,
             ITmpSubsystemRepository iTmpSubsystemRepository,
             ITmpAuditStructureRepository iTmpAuditStructureRepository,
             TmpSubsystemRepository tmpSubsystemRepository,
             TmpAuditStructureRepository tmpAuditStructureRepository) {
         this.namesService = namesService;
-        this.iSubsystemRepository = iSubsystemRepository;
-        this.subsystemRepository = subsystemRepository;
         this.iTmpSystemRepository = iTmpSystemRepository;
         this.iTmpSubsystemRepository = iTmpSubsystemRepository;
         this.iTmpAuditStructureRepository = iTmpAuditStructureRepository;
@@ -99,12 +85,13 @@ public class SubsystemService {
 
     @Transactional(propagation = Propagation.MANDATORY)
     public StructureElementNotification createStructure(StructureElementCommand structureElementCommand, Date when, String username,
-            EssNamingConvention namingConvention, HolderStructures holderStructures, HolderTmpStructures holderTmpStructures) {
+            EssNamingConvention namingConvention, HolderTmpStructures holderTmpStructures) {
 
         // validation outside method
         // transaction
         //     support a current transaction, throw an exception if none exists
-        //     create structure - approved, latest, not deleted
+        //     create structure
+        //     create audit
         //     additional
         //         automatically create name when system structure is created
         //         conditions on name and structure entry
@@ -119,16 +106,8 @@ public class SubsystemService {
         mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic;
         String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic);
 
-        // create
-        Subsystem subsystem = new Subsystem(uuid, structureElementCommand.getParent(),
-                mnemonic, equivalenceClassRepresentative, structureElementCommand.getOrdering(),
-                structureElementCommand.getDescription(), Status.APPROVED, Boolean.TRUE, Boolean.FALSE,
-                when, username, null);
-        subsystemRepository.createSubsystem(subsystem);
-
-        // create tmp
+        // create structure
         // create audit
-        // <TMP>
         TmpSystem tmpSystem = iTmpSystemRepository.findByUuid(structureElementCommand.getParent().toString());
         TmpSubsystem tmpSubsystem = new TmpSubsystem(uuid, tmpSystem.getId(),
                 mnemonic, equivalenceClassRepresentative, structureElementCommand.getOrdering(),
@@ -136,76 +115,44 @@ public class SubsystemService {
                 when, username, null);
         tmpSubsystemRepository.createSubsystem(tmpSubsystem);
         tmpAuditStructureRepository.createTmpAuditStructure(new TmpAuditStructure(TextUtil.CREATE, tmpSubsystem));
-        // </TMP>
 
         // additional
-        boolean hasMnemonic = !StringUtils.isEmpty(subsystem.getMnemonic());
-        boolean existsName = hasMnemonic && namesService.existsName(StructureUtil.getMnemonicPath(subsystem, holderStructures));
-        // <tmp>
-        boolean tmpHasMnemonic = !StringUtils.isEmpty(subsystem.getMnemonic());
+        boolean tmpHasMnemonic = !StringUtils.isEmpty(tmpSubsystem.getMnemonic());
         boolean tmpExistsName = tmpHasMnemonic && namesService.existsName(StructureUtil.getMnemonicPath(tmpSubsystem, holderTmpStructures));
-        // </tmp>
-        // if (hasMnemonic && !existsName) {
-        if (hasMnemonic && !existsName && tmpHasMnemonic && !tmpExistsName) {
-            NameElementCommand nameElement = new NameElementCommand(null, subsystem.getUuid(), null, null, StructuresService.SYSTEM_STRUCTURE_ONLY);
-            namesService.createName(nameElement, when, username, holderStructures, holderTmpStructures);
+        if (tmpHasMnemonic && !tmpExistsName) {
+            NameElementCommand nameElement = new NameElementCommand(null, tmpSubsystem.getUuid(), null, null, StructuresService.SYSTEM_STRUCTURE_ONLY);
+            namesService.createName(nameElement, when, username, holderTmpStructures, tmpSubsystem);
         }
 
         LOGGER.log(Level.FINE, () -> MessageFormat.format(TextUtil.DESCRIPTION_NAME_VALUE, TextUtil.CREATE_STRUCTURE, TextUtil.COMMAND, StructureCommand.CREATE));
 
         return new StructureElementNotification(
-                StructureElementUtil.getStructureElementProcessed(subsystem, holderStructures, StructureChoice.STRUCTURE),
+                StructureElementUtil.getStructureElementProcessed(tmpSubsystem, holderTmpStructures, StructureChoice.STRUCTURE),
                 NotificationUtil.prepareNotification(Type.SUBSYSTEM, StructureCommand.CREATE, null, tmpSubsystem, holderTmpStructures));
     }
 
     @Transactional(propagation = Propagation.MANDATORY)
     public StructureElementNotification updateStructure(StructureElementCommand structureElementCommand, Date when, String username,
-            EssNamingConvention namingConvention, HolderStructures holderStructures, HolderTmpStructures holderTmpStructures) {
+            EssNamingConvention namingConvention, HolderTmpStructures holderTmpStructures) {
 
         // validation outside method
         // transaction
         //     support a current transaction, throw an exception if none exists
-        //     update not latest
-        //     create structure - approved, latest, not deleted
+        //     update structure
+        //     create audit
         //     previous for notification
         //     additional - update related names
         //     return
         //         structure element for updated structure
         //         notification
-        //
-        // attributes
-        //     uuid, type, parent, mnemonic, ordering, description
-
-        // note
-        //     namingConvention.equivalenceClassRepresentative return null for null input
-        //     rules for mnemonic
 
         String uuid = structureElementCommand.getUuid().toString();
         String mnemonic = structureElementCommand.getMnemonic();
         mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic;
         String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic);
 
-        // find
-        List<Subsystem> subsystems = subsystemRepository.readSubsystems(Boolean.FALSE, uuid, null, null, null, null, null, null);
-        Subsystem subsystem = null;
-        if (ValidateUtil.isSize(subsystems, 1)) {
-            subsystem = subsystems.get(0);
-
-            // update not latest
-            subsystem.setLatest(Boolean.FALSE);
-            subsystemRepository.updateSubsystem(subsystem);
-        }
-
-        // create
-        subsystem = new Subsystem(structureElementCommand.getUuid(), structureElementCommand.getParent(),
-                mnemonic, equivalenceClassRepresentative, structureElementCommand.getOrdering(),
-                structureElementCommand.getDescription(), Status.APPROVED, Boolean.TRUE, Boolean.FALSE,
-                when, username, null);
-        subsystemRepository.createSubsystem(subsystem);
-
-        // update tmp
+        // update structure
         // create audit
-        // <TMP>
         TmpSubsystem tmpSubsystem = iTmpSubsystemRepository.findByUuid(uuid);
         tmpSubsystem.setMnemonic(mnemonic);
         tmpSubsystem.setMnemonicEquivalence(equivalenceClassRepresentative);
@@ -214,35 +161,30 @@ public class SubsystemService {
         tmpSubsystemRepository.updateSubsystem(tmpSubsystem);
         TmpAuditStructure tmpAuditStructure = new TmpAuditStructure(TextUtil.UPDATE, tmpSubsystem);
         tmpAuditStructureRepository.createTmpAuditStructure(tmpAuditStructure);
-        // </TMP>
 
         // previous
-        List<Subsystem> previouses = iSubsystemRepository.findPreviousByUuidAndId(subsystem.getUuid().toString(), subsystem.getId());
-        Subsystem previous = previouses != null && !previouses.isEmpty() ? previouses.get(0) : null;
-        // <TMP>
         TmpAuditStructure tmpPreviousAuditStructure = iTmpAuditStructureRepository.findPreviousByAuditTableAndUuidAndAuditId(Type.SUBSYSTEM.name().toLowerCase(), uuid, tmpAuditStructure.getAuditId());
-        TmpSubsystem tmpPrevious = StructureUtil.convert2Subsystem(tmpPreviousAuditStructure);
-        // </TMP>
+        TmpSubsystem tmpPrevious = new TmpSubsystem(tmpPreviousAuditStructure);
 
         // additional
-        namesService.updateNames(previous, subsystem, username);
+        namesService.updateNames(tmpPrevious, tmpSubsystem, username, holderTmpStructures);
 
         LOGGER.log(Level.FINE, () -> MessageFormat.format(TextUtil.DESCRIPTION_NAME_VALUE, TextUtil.UPDATE_STRUCTURE, TextUtil.COMMAND, StructureCommand.UPDATE));
 
         return new StructureElementNotification(
-                StructureElementUtil.getStructureElementProcessed(subsystem, holderStructures, StructureChoice.STRUCTURE),
+                StructureElementUtil.getStructureElementProcessed(tmpSubsystem, holderTmpStructures, StructureChoice.STRUCTURE),
                 NotificationUtil.prepareNotification(Type.SUBSYSTEM, StructureCommand.UPDATE, tmpPrevious, tmpSubsystem, holderTmpStructures));
     }
 
     @Transactional(propagation = Propagation.MANDATORY)
     public StructureElementNotification deleteStructure(StructureElementCommand structureElementCommand, Date when, String username,
-            HolderStructures holderStructures, HolderTmpStructures holderTmpStructures) {
+            HolderTmpStructures holderTmpStructures) {
 
         // validation outside method
         // transaction
         //     support a current transaction, throw an exception if none exists
-        //     update structure - not latest
-        //     create structure - approved, latest, deleted
+        //     delete structure (update)
+        //     create audit
         //     previous for notification
         //     additional
         //         delete related names
@@ -252,50 +194,26 @@ public class SubsystemService {
 
         String uuid = structureElementCommand.getUuid().toString();
 
-        // update
-        List<Subsystem> subsystems = subsystemRepository.readSubsystems(Boolean.FALSE, uuid, null, null, null, null, null, null);
-        Subsystem subsystem = null;
-        if (ValidateUtil.isSize(subsystems, 1)) {
-            subsystem = subsystems.get(0);
-            subsystem.setLatest(Boolean.FALSE);
-            subsystemRepository.updateSubsystem(subsystem);
-        } else {
-            return null;
-        }
-
-        // create
-        subsystem = new Subsystem(subsystem.getUuid(), subsystem.getParentUuid(),
-                subsystem.getMnemonic(), subsystem.getMnemonicEquivalence(), subsystem.getOrdering(),
-                subsystem.getDescription(), Status.APPROVED, Boolean.TRUE, Boolean.TRUE,
-                when, username, null);
-        subsystemRepository.createSubsystem(subsystem);
-
-        // update tmp
+        // delete structure
         // create audit
-        // <TMP>
         TmpSubsystem tmpSubsystem = iTmpSubsystemRepository.findByUuid(uuid);
         tmpSubsystem.setDeleted(Boolean.TRUE);
         tmpSubsystem.setAttributesProcessed(when, username, null);
         tmpSubsystemRepository.updateSubsystem(tmpSubsystem);
         TmpAuditStructure tmpAuditStructure = new TmpAuditStructure(TextUtil.DELETE, tmpSubsystem);
         tmpAuditStructureRepository.createTmpAuditStructure(tmpAuditStructure);
-        // </TMP>
 
         // previous
-        List<Subsystem> previouses = iSubsystemRepository.findPreviousByUuidAndId(uuid, subsystem.getId());
-        Subsystem previous = previouses != null && !previouses.isEmpty() ? previouses.get(0) : null;
-        // <TMP>
         TmpAuditStructure tmpPreviousAuditStructure = iTmpAuditStructureRepository.findPreviousByAuditTableAndUuidAndAuditId(Type.SUBSYSTEM.name().toLowerCase(), uuid, tmpAuditStructure.getAuditId());
-        TmpSubsystem tmpPrevious = StructureUtil.convert2Subsystem(tmpPreviousAuditStructure);
-        // </TMP>
+        TmpSubsystem tmpPrevious = new TmpSubsystem(tmpPreviousAuditStructure);
 
         // additional
-        namesService.deleteNames(subsystem, username);
+        namesService.deleteNames(tmpSubsystem, username, holderTmpStructures);
 
         LOGGER.log(Level.FINE, () -> MessageFormat.format(TextUtil.DESCRIPTION_NAME_VALUE, TextUtil.DELETE_STRUCTURE, TextUtil.COMMAND, StructureCommand.DELETE));
 
         return new StructureElementNotification(
-                StructureElementUtil.getStructureElementProcessed(subsystem, holderStructures, StructureChoice.STRUCTURE),
+                StructureElementUtil.getStructureElementProcessed(tmpSubsystem, holderTmpStructures, StructureChoice.STRUCTURE),
                 NotificationUtil.prepareNotification(Type.SUBSYSTEM, StructureCommand.DELETE, tmpPrevious, tmpSubsystem, holderTmpStructures));
     }
 
diff --git a/src/main/java/org/openepics/names/service/SystemGroupService.java b/src/main/java/org/openepics/names/service/SystemGroupService.java
index 9aeb32be..19a3ad53 100644
--- a/src/main/java/org/openepics/names/service/SystemGroupService.java
+++ b/src/main/java/org/openepics/names/service/SystemGroupService.java
@@ -26,15 +26,12 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.apache.commons.lang3.StringUtils;
-import org.openepics.names.repository.ISystemGroupRepository;
-import org.openepics.names.repository.ISystemRepository;
-import org.openepics.names.repository.SystemGroupRepository;
-import org.openepics.names.repository.model.System;
-import org.openepics.names.repository.model.SystemGroup;
 import org.openepics.names.repository.model.tmp.TmpAuditStructure;
+import org.openepics.names.repository.model.tmp.TmpSystem;
 import org.openepics.names.repository.model.tmp.TmpSystemGroup;
 import org.openepics.names.repository.tmp.ITmpAuditStructureRepository;
 import org.openepics.names.repository.tmp.ITmpSystemGroupRepository;
+import org.openepics.names.repository.tmp.ITmpSystemRepository;
 import org.openepics.names.repository.tmp.TmpAuditStructureRepository;
 import org.openepics.names.repository.tmp.TmpSystemGroupRepository;
 import org.openepics.names.rest.beans.Status;
@@ -42,14 +39,12 @@ import org.openepics.names.rest.beans.Type;
 import org.openepics.names.rest.beans.element.NameElementCommand;
 import org.openepics.names.rest.beans.element.StructureElementCommand;
 import org.openepics.names.util.EssNamingConvention;
-import org.openepics.names.util.HolderStructures;
 import org.openepics.names.util.HolderTmpStructures;
 import org.openepics.names.util.StructureChoice;
 import org.openepics.names.util.StructureCommand;
 import org.openepics.names.util.StructureElementUtil;
 import org.openepics.names.util.StructureUtil;
 import org.openepics.names.util.TextUtil;
-import org.openepics.names.util.ValidateUtil;
 import org.openepics.names.util.notification.NotificationUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -70,10 +65,8 @@ public class SystemGroupService {
 
     private NamesService namesService;
     private SystemService systemService;
-    private ISystemGroupRepository iSystemGroupRepository;
-    private ISystemRepository iSystemRepository;
-    private SystemGroupRepository systemGroupRepository;
     private ITmpSystemGroupRepository iTmpSystemGroupRepository;
+    private ITmpSystemRepository iTmpSystemRepository;
     private ITmpAuditStructureRepository iTmpAuditStructureRepository;
     private TmpSystemGroupRepository tmpSystemGroupRepository;
     private TmpAuditStructureRepository tmpAuditStructureRepository;
@@ -82,19 +75,15 @@ public class SystemGroupService {
     public SystemGroupService(
             NamesService namesService,
             SystemService systemService,
-            ISystemGroupRepository iSystemGroupRepository,
-            ISystemRepository iSystemRepository,
-            SystemGroupRepository systemGroupRepository,
             ITmpSystemGroupRepository iTmpSystemGroupRepository,
+            ITmpSystemRepository iTmpSystemRepository,
             ITmpAuditStructureRepository iTmpAuditStructureRepository,
             TmpSystemGroupRepository tmpSystemGroupRepository,
             TmpAuditStructureRepository tmpAuditStructureRepository) {
         this.namesService = namesService;
         this.systemService = systemService;
-        this.iSystemGroupRepository = iSystemGroupRepository;
-        this.iSystemRepository = iSystemRepository;
-        this.systemGroupRepository = systemGroupRepository;
         this.iTmpSystemGroupRepository = iTmpSystemGroupRepository;
+        this.iTmpSystemRepository = iTmpSystemRepository;
         this.iTmpAuditStructureRepository = iTmpAuditStructureRepository;
         this.tmpSystemGroupRepository = tmpSystemGroupRepository;
         this.tmpAuditStructureRepository = tmpAuditStructureRepository;
@@ -102,11 +91,12 @@ public class SystemGroupService {
 
     @Transactional(propagation = Propagation.MANDATORY)
     public StructureElementNotification createStructure(StructureElementCommand structureElementCommand, Date when, String username,
-            EssNamingConvention namingConvention, HolderStructures holderStructures, HolderTmpStructures holderTmpStructures) {
+            EssNamingConvention namingConvention, HolderTmpStructures holderTmpStructures) {
         // validation outside method
         // transaction
         //     support a current transaction, throw an exception if none exists
-        //     create structure - approved, latest, not deleted
+        //     create structure
+        //     create audit
         //     additional
         //         automatically create name when system structure is created
         //         conditions on name and structure entry
@@ -121,53 +111,39 @@ public class SystemGroupService {
         mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic;
         String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic);
 
-        // create
-        SystemGroup systemGroup = new SystemGroup(uuid,
-                mnemonic, equivalenceClassRepresentative, structureElementCommand.getOrdering(),
-                structureElementCommand.getDescription(), Status.APPROVED, Boolean.TRUE, Boolean.FALSE,
-                when, username, null);
-        systemGroupRepository.createSystemGroup(systemGroup);
-
-        // create tmp
+        // create structure
         // create audit
-        // <TMP>
         TmpSystemGroup tmpSystemGroup = new TmpSystemGroup(uuid,
                 mnemonic, equivalenceClassRepresentative, structureElementCommand.getOrdering(),
                 structureElementCommand.getDescription(), Status.APPROVED, Boolean.FALSE,
                 when, username, null);
         tmpSystemGroupRepository.createSystemGroup(tmpSystemGroup);
         tmpAuditStructureRepository.createTmpAuditStructure(new TmpAuditStructure(TextUtil.CREATE, tmpSystemGroup));
-        // </TMP>
 
         // additional
-        boolean hasMnemonic = !StringUtils.isEmpty(systemGroup.getMnemonic());
-        boolean existsName = hasMnemonic && namesService.existsName(StructureUtil.getMnemonicPath(systemGroup, holderStructures));
-        // <tmp>
         boolean tmpHasMnemonic = !StringUtils.isEmpty(tmpSystemGroup.getMnemonic());
         boolean tmpExistsName = tmpHasMnemonic && namesService.existsName(StructureUtil.getMnemonicPath(tmpSystemGroup, holderTmpStructures));
-        // </tmp>
-        // if (hasMnemonic && !existsName) {
-        if (hasMnemonic && !existsName && tmpHasMnemonic && !tmpExistsName) {
-            NameElementCommand nameElement = new NameElementCommand(null, systemGroup.getUuid(), null, null, StructuresService.SYSTEM_STRUCTURE_ONLY);
-            namesService.createName(nameElement, when, username, holderStructures, holderTmpStructures);
+        if (tmpHasMnemonic && !tmpExistsName) {
+            NameElementCommand nameElement = new NameElementCommand(null, tmpSystemGroup.getUuid(), null, null, StructuresService.SYSTEM_STRUCTURE_ONLY);
+            namesService.createName(nameElement, when, username, holderTmpStructures, tmpSystemGroup);
         }
 
         LOGGER.log(Level.FINE, () -> MessageFormat.format(TextUtil.DESCRIPTION_NAME_VALUE, TextUtil.CREATE_STRUCTURE, TextUtil.COMMAND, StructureCommand.CREATE));
 
         return new StructureElementNotification(
-                StructureElementUtil.getStructureElementProcessed(systemGroup, holderStructures, StructureChoice.STRUCTURE),
+                StructureElementUtil.getStructureElementProcessed(tmpSystemGroup, holderTmpStructures, StructureChoice.STRUCTURE),
                 NotificationUtil.prepareNotification(Type.SYSTEMGROUP, StructureCommand.CREATE, null, tmpSystemGroup, holderTmpStructures));
     }
 
     @Transactional(propagation = Propagation.MANDATORY)
     public StructureElementNotification updateStructure(StructureElementCommand structureElementCommand, Date when, String username,
-            EssNamingConvention namingConvention, HolderStructures holderStructures, HolderTmpStructures holderTmpStructures) {
+            EssNamingConvention namingConvention, HolderTmpStructures holderTmpStructures) {
 
         // validation outside method
         // transaction
         //     support a current transaction, throw an exception if none exists
-        //     update structure - not latest
-        //     create structure - approved, latest, not deleted
+        //     update structure
+        //     create audit
         //     previous for notification
         //     additional
         //         update related names
@@ -180,25 +156,8 @@ public class SystemGroupService {
         mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic;
         String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic);
 
-        // update
-        List<SystemGroup> systemGroups = systemGroupRepository.readSystemGroups(Boolean.FALSE, uuid, null, null, null, null, null);
-        SystemGroup systemGroup = null;
-        if (ValidateUtil.isSize(systemGroups, 1)) {
-            systemGroup = systemGroups.get(0);
-            systemGroup.setLatest(Boolean.FALSE);
-            systemGroupRepository.updateSystemGroup(systemGroup);
-        }
-
-        // create
-        systemGroup = new SystemGroup(structureElementCommand.getUuid(),
-                mnemonic, equivalenceClassRepresentative, structureElementCommand.getOrdering(),
-                structureElementCommand.getDescription(), Status.APPROVED, Boolean.TRUE, Boolean.FALSE,
-                when, username, null);
-        systemGroupRepository.createSystemGroup(systemGroup);
-
-        // update tmp
+        // update structure
         // create audit
-        // <TMP>
         TmpSystemGroup tmpSystemGroup = iTmpSystemGroupRepository.findByUuid(uuid);
         tmpSystemGroup.setMnemonic(mnemonic);
         tmpSystemGroup.setMnemonicEquivalence(equivalenceClassRepresentative);
@@ -207,35 +166,30 @@ public class SystemGroupService {
         tmpSystemGroupRepository.updateSystemGroup(tmpSystemGroup);
         TmpAuditStructure tmpAuditStructure = new TmpAuditStructure(TextUtil.UPDATE, tmpSystemGroup);
         tmpAuditStructureRepository.createTmpAuditStructure(tmpAuditStructure);
-        // </TMP>
 
         // previous
-        List<SystemGroup> previouses = iSystemGroupRepository.findPreviousByUuidAndId(uuid, systemGroup.getId());
-        SystemGroup previous = previouses != null && !previouses.isEmpty() ? previouses.get(0) : null;
-        // <TMP>
         TmpAuditStructure tmpPreviousAuditStructure = iTmpAuditStructureRepository.findPreviousByAuditTableAndUuidAndAuditId(Type.SYSTEMGROUP.name().toLowerCase(), uuid, tmpAuditStructure.getAuditId());
-        TmpSystemGroup tmpPrevious = StructureUtil.convert2SystemGroup(tmpPreviousAuditStructure);
-        // </TMP>
+        TmpSystemGroup tmpPrevious = new TmpSystemGroup(tmpPreviousAuditStructure);
 
         // additional
-        namesService.updateNames(previous, systemGroup, username);
+        namesService.updateNames(tmpPrevious, tmpSystemGroup, username, holderTmpStructures);
 
         LOGGER.log(Level.FINE, () -> MessageFormat.format(TextUtil.DESCRIPTION_NAME_VALUE, TextUtil.UPDATE_STRUCTURE, TextUtil.COMMAND, StructureCommand.UPDATE));
 
         return new StructureElementNotification(
-                StructureElementUtil.getStructureElementProcessed(systemGroup, holderStructures, StructureChoice.STRUCTURE),
+                StructureElementUtil.getStructureElementProcessed(tmpSystemGroup, holderTmpStructures, StructureChoice.STRUCTURE),
                 NotificationUtil.prepareNotification(Type.SYSTEMGROUP, StructureCommand.UPDATE, tmpPrevious, tmpSystemGroup, holderTmpStructures));
     }
 
     @Transactional(propagation = Propagation.MANDATORY)
     public StructureElementNotification deleteStructure(StructureElementCommand structureElementCommand, Date when, String username,
-            HolderStructures holderStructures, HolderTmpStructures holderTmpStructures) {
+            HolderTmpStructures holderTmpStructures) {
 
         // validation outside method
         // transaction
         //     support a current transaction, throw an exception if none exists
-        //     update structure - not latest
-        //     create structure - approved, latest, deleted
+        //     delete structure (update)
+        //     create audit
         //     previous for notification
         //     additional
         //         delete related names
@@ -246,60 +200,36 @@ public class SystemGroupService {
 
         String uuid = structureElementCommand.getUuid().toString();
 
-        // update
-        List<SystemGroup> systemGroups = systemGroupRepository.readSystemGroups(Boolean.FALSE, uuid, null, null, null, null, null);
-        SystemGroup systemGroup = null;
-        if (ValidateUtil.isSize(systemGroups, 1)) {
-            systemGroup = systemGroups.get(0);
-            systemGroup.setLatest(Boolean.FALSE);
-            systemGroupRepository.updateSystemGroup(systemGroup);
-        } else {
-            return null;
-        }
-
-        // create
-        systemGroup = new SystemGroup(systemGroup.getUuid(),
-                systemGroup.getMnemonic(), systemGroup.getMnemonicEquivalence(), systemGroup.getOrdering(),
-                systemGroup.getDescription(), Status.APPROVED, Boolean.TRUE, Boolean.TRUE,
-                when, username, null);
-        systemGroupRepository.createSystemGroup(systemGroup);
-
-        // update tmp
+        // delete structure
         // create audit
-        // <TMP>
         TmpSystemGroup tmpSystemGroup = iTmpSystemGroupRepository.findByUuid(uuid);
         tmpSystemGroup.setDeleted(Boolean.TRUE);
         tmpSystemGroup.setAttributesProcessed(when, username, null);
         tmpSystemGroupRepository.updateSystemGroup(tmpSystemGroup);
         TmpAuditStructure tmpAuditStructure = new TmpAuditStructure(TextUtil.DELETE, tmpSystemGroup);
         tmpAuditStructureRepository.createTmpAuditStructure(tmpAuditStructure);
-        // </TMP>
 
         // previous
-        List<SystemGroup> previouses = iSystemGroupRepository.findPreviousByUuidAndId(uuid, systemGroup.getId());
-        SystemGroup previous = previouses != null && !previouses.isEmpty() ? previouses.get(0) : null;
-        // <TMP>
         TmpAuditStructure tmpPreviousAuditStructure = iTmpAuditStructureRepository.findPreviousByAuditTableAndUuidAndAuditId(Type.SYSTEMGROUP.name().toLowerCase(), uuid, tmpAuditStructure.getAuditId());
-        TmpSystemGroup tmpPrevious = StructureUtil.convert2SystemGroup(tmpPreviousAuditStructure);
-        // </TMP>
+        TmpSystemGroup tmpPrevious = new TmpSystemGroup(tmpPreviousAuditStructure);
 
         // additional
         //     will propagate to sub structures
-        namesService.deleteNames(systemGroup, username);
+        namesService.deleteNames(tmpSystemGroup, username, holderTmpStructures);
 
         List<StructureElementCommand> commands = Lists.newArrayList();
-        List<System> systems = iSystemRepository.findLatestNotDeletedByParent(uuid);
-        for (System system : systems) {
+        List<TmpSystem> systems = iTmpSystemRepository.findNotDeletedByParent(tmpSystemGroup.getId());
+        for (TmpSystem system : systems) {
             commands.add(new StructureElementCommand(system.getUuid(), Type.SYSTEM, null, null, null, null));
         }
         for (StructureElementCommand command : commands) {
-            systemService.deleteStructure(command, when, username, holderStructures, holderTmpStructures);
+            systemService.deleteStructure(command, when, username, holderTmpStructures);
         }
 
         LOGGER.log(Level.FINE, () -> MessageFormat.format(TextUtil.DESCRIPTION_NAME_VALUE, TextUtil.DELETE_STRUCTURE, TextUtil.COMMAND, StructureCommand.DELETE));
 
         return new StructureElementNotification(
-                StructureElementUtil.getStructureElementProcessed(systemGroup, holderStructures, StructureChoice.STRUCTURE),
+                StructureElementUtil.getStructureElementProcessed(tmpSystemGroup, holderTmpStructures, StructureChoice.STRUCTURE),
                 NotificationUtil.prepareNotification(Type.SYSTEMGROUP, StructureCommand.DELETE, tmpPrevious, tmpSystemGroup, holderTmpStructures));
     }
 
diff --git a/src/main/java/org/openepics/names/service/SystemService.java b/src/main/java/org/openepics/names/service/SystemService.java
index 260badc3..9e726c5d 100644
--- a/src/main/java/org/openepics/names/service/SystemService.java
+++ b/src/main/java/org/openepics/names/service/SystemService.java
@@ -26,15 +26,12 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.apache.commons.lang3.StringUtils;
-import org.openepics.names.repository.ISubsystemRepository;
-import org.openepics.names.repository.ISystemRepository;
-import org.openepics.names.repository.SystemRepository;
-import org.openepics.names.repository.model.Subsystem;
-import org.openepics.names.repository.model.System;
 import org.openepics.names.repository.model.tmp.TmpAuditStructure;
+import org.openepics.names.repository.model.tmp.TmpSubsystem;
 import org.openepics.names.repository.model.tmp.TmpSystem;
 import org.openepics.names.repository.model.tmp.TmpSystemGroup;
 import org.openepics.names.repository.tmp.ITmpAuditStructureRepository;
+import org.openepics.names.repository.tmp.ITmpSubsystemRepository;
 import org.openepics.names.repository.tmp.ITmpSystemGroupRepository;
 import org.openepics.names.repository.tmp.ITmpSystemRepository;
 import org.openepics.names.repository.tmp.TmpAuditStructureRepository;
@@ -44,14 +41,12 @@ import org.openepics.names.rest.beans.Type;
 import org.openepics.names.rest.beans.element.NameElementCommand;
 import org.openepics.names.rest.beans.element.StructureElementCommand;
 import org.openepics.names.util.EssNamingConvention;
-import org.openepics.names.util.HolderStructures;
 import org.openepics.names.util.HolderTmpStructures;
 import org.openepics.names.util.StructureChoice;
 import org.openepics.names.util.StructureCommand;
 import org.openepics.names.util.StructureElementUtil;
 import org.openepics.names.util.StructureUtil;
 import org.openepics.names.util.TextUtil;
-import org.openepics.names.util.ValidateUtil;
 import org.openepics.names.util.notification.NotificationUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -72,11 +67,9 @@ public class SystemService {
 
     private NamesService namesService;
     private SubsystemService subsystemService;
-    private ISystemRepository iSystemRepository;
-    private ISubsystemRepository iSubsystemRepository;
-    private SystemRepository systemRepository;
     private ITmpSystemGroupRepository iTmpSystemGroupRepository;
     private ITmpSystemRepository iTmpSystemRepository;
+    private ITmpSubsystemRepository iTmpSubsystemRepository;
     private ITmpAuditStructureRepository iTmpAuditStructureRepository;
     private TmpSystemRepository tmpSystemRepository;
     private TmpAuditStructureRepository tmpAuditStructureRepository;
@@ -85,21 +78,17 @@ public class SystemService {
     public SystemService(
             NamesService namesService,
             SubsystemService subsystemService,
-            ISystemRepository iSystemRepository,
-            ISubsystemRepository iSubsystemRepository,
-            SystemRepository systemRepository,
             ITmpSystemGroupRepository iTmpSystemGroupRepository,
             ITmpSystemRepository iTmpSystemRepository,
+            ITmpSubsystemRepository iTmpSubsystemRepository,
             ITmpAuditStructureRepository iTmpAuditStructureRepository,
             TmpSystemRepository tmpSystemRepository,
             TmpAuditStructureRepository tmpAuditStructureRepository) {
         this.namesService = namesService;
         this.subsystemService = subsystemService;
-        this.iSystemRepository = iSystemRepository;
-        this.iSubsystemRepository = iSubsystemRepository;
-        this.systemRepository = systemRepository;
         this.iTmpSystemGroupRepository = iTmpSystemGroupRepository;
         this.iTmpSystemRepository = iTmpSystemRepository;
+        this.iTmpSubsystemRepository = iTmpSubsystemRepository;
         this.iTmpAuditStructureRepository = iTmpAuditStructureRepository;
         this.tmpSystemRepository = tmpSystemRepository;
         this.tmpAuditStructureRepository = tmpAuditStructureRepository;
@@ -107,12 +96,13 @@ public class SystemService {
 
     @Transactional(propagation = Propagation.MANDATORY)
     public StructureElementNotification createStructure(StructureElementCommand structureElementCommand, Date when, String username,
-            EssNamingConvention namingConvention, HolderStructures holderStructures, HolderTmpStructures holderTmpStructures) {
+            EssNamingConvention namingConvention, HolderTmpStructures holderTmpStructures) {
 
         // validation outside method
         // transaction
         //     support a current transaction, throw an exception if none exists
-        //     create structure - approved, latest, not deleted
+        //     create structure
+        //     create audit
         //     additional
         //         automatically create name when system structure is created
         //         conditions on name and structure entry
@@ -127,16 +117,8 @@ public class SystemService {
         mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic;
         String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic);
 
-        // create
-        System system = new System(uuid, structureElementCommand.getParent(),
-                mnemonic, equivalenceClassRepresentative, structureElementCommand.getOrdering(),
-                structureElementCommand.getDescription(), Status.APPROVED, Boolean.TRUE, Boolean.FALSE,
-                when, username, null);
-        systemRepository.createSystem(system);
-
-        // create tmp
+        // create structure
         // create audit
-        // <TMP>
         TmpSystemGroup tmpSystemGroup = iTmpSystemGroupRepository.findByUuid(structureElementCommand.getParent().toString());
         TmpSystem tmpSystem = new TmpSystem(uuid, tmpSystemGroup.getId(),
                 mnemonic, equivalenceClassRepresentative, structureElementCommand.getOrdering(),
@@ -144,76 +126,44 @@ public class SystemService {
                 when, username, null);
         tmpSystemRepository.createSystem(tmpSystem);
         tmpAuditStructureRepository.createTmpAuditStructure(new TmpAuditStructure(TextUtil.CREATE, tmpSystem));
-        // </TMP>
 
         // additional
-        boolean hasMnemonic = !StringUtils.isEmpty(system.getMnemonic());
-        boolean existsName = hasMnemonic && namesService.existsName(StructureUtil.getMnemonicPath(system, holderStructures));
-        // <tmp>
         boolean tmpHasMnemonic = !StringUtils.isEmpty(tmpSystem.getMnemonic());
         boolean tmpExistsName = tmpHasMnemonic && namesService.existsName(StructureUtil.getMnemonicPath(tmpSystem, holderTmpStructures));
-        // </tmp>
-        // if (hasMnemonic && !existsName) {
-        if (hasMnemonic && !existsName && tmpHasMnemonic && !tmpExistsName) {
-            NameElementCommand nameElement = new NameElementCommand(null, system.getUuid(), null, null, StructuresService.SYSTEM_STRUCTURE_ONLY);
-            namesService.createName(nameElement, when, username, holderStructures, holderTmpStructures);
+        if (tmpHasMnemonic && !tmpExistsName) {
+            NameElementCommand nameElement = new NameElementCommand(null, tmpSystem.getUuid(), null, null, StructuresService.SYSTEM_STRUCTURE_ONLY);
+            namesService.createName(nameElement, when, username, holderTmpStructures, tmpSystem);
         }
 
         LOGGER.log(Level.FINE, () -> MessageFormat.format(TextUtil.DESCRIPTION_NAME_VALUE, TextUtil.CREATE_STRUCTURE, TextUtil.COMMAND, StructureCommand.CREATE));
 
         return new StructureElementNotification(
-                StructureElementUtil.getStructureElementProcessed(system, holderStructures, StructureChoice.STRUCTURE),
+                StructureElementUtil.getStructureElementProcessed(tmpSystem, holderTmpStructures, StructureChoice.STRUCTURE),
                 NotificationUtil.prepareNotification(Type.SYSTEM, StructureCommand.CREATE, null, tmpSystem, holderTmpStructures));
     }
 
     @Transactional(propagation = Propagation.MANDATORY)
     public StructureElementNotification updateStructure(StructureElementCommand structureElementCommand, Date when, String username,
-            EssNamingConvention namingConvention, HolderStructures holderStructures, HolderTmpStructures holderTmpStructures) {
+            EssNamingConvention namingConvention, HolderTmpStructures holderTmpStructures) {
 
         // validation outside method
         // transaction
         //     support a current transaction, throw an exception if none exists
-        //     update not latest
-        //     create structure - approved, latest, not deleted
+        //     update structure
+        //     create audit
         //     previous for notification
         //     additional - update related names
         //     return
         //         structure element for updated structure
         //         notification
-        //
-        // attributes
-        //     uuid, type, parent, mnemonic, ordering, description
-
-        // note
-        //     namingConvention.equivalenceClassRepresentative return null for null input
-        //     rules for mnemonic
 
         String uuid = structureElementCommand.getUuid().toString();
         String mnemonic = structureElementCommand.getMnemonic();
         mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic;
         String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic);
 
-        // find
-        List<System> systems = systemRepository.readSystems(Boolean.FALSE, uuid, null, null, null, null, null, null);
-        System system = null;
-        if (ValidateUtil.isSize(systems, 1)) {
-            system = systems.get(0);
-
-            // update not latest
-            system.setLatest(Boolean.FALSE);
-            systemRepository.updateSystem(system);
-        }
-
-        // create
-        system = new System(structureElementCommand.getUuid(), structureElementCommand.getParent(),
-                mnemonic, equivalenceClassRepresentative, structureElementCommand.getOrdering(),
-                structureElementCommand.getDescription(), Status.APPROVED, Boolean.TRUE, Boolean.FALSE,
-                when, username, null);
-        systemRepository.createSystem(system);
-
-        // update tmp
+        // update structure
         // create audit
-        // <TMP>
         TmpSystem tmpSystem = iTmpSystemRepository.findByUuid(uuid);
         tmpSystem.setMnemonic(mnemonic);
         tmpSystem.setMnemonicEquivalence(equivalenceClassRepresentative);
@@ -222,35 +172,30 @@ public class SystemService {
         tmpSystemRepository.updateSystem(tmpSystem);
         TmpAuditStructure tmpAuditStructure = new TmpAuditStructure(TextUtil.UPDATE, tmpSystem);
         tmpAuditStructureRepository.createTmpAuditStructure(tmpAuditStructure);
-        // </TMP>
 
         // previous
-        List<System> previouses = iSystemRepository.findPreviousByUuidAndId(system.getUuid().toString(), system.getId());
-        System previous = previouses != null && !previouses.isEmpty() ? previouses.get(0) : null;
-        // <TMP>
         TmpAuditStructure tmpPreviousAuditStructure = iTmpAuditStructureRepository.findPreviousByAuditTableAndUuidAndAuditId(Type.SYSTEM.name().toLowerCase(), uuid, tmpAuditStructure.getAuditId());
-        TmpSystem tmpPrevious = StructureUtil.convert2System(tmpPreviousAuditStructure);
-        // </TMP>
+        TmpSystem tmpPrevious = new TmpSystem(tmpPreviousAuditStructure);
 
         // additional
-        namesService.updateNames(previous, system, username);
+        namesService.updateNames(tmpPrevious, tmpSystem, username, holderTmpStructures);
 
         LOGGER.log(Level.FINE, () -> MessageFormat.format(TextUtil.DESCRIPTION_NAME_VALUE, TextUtil.UPDATE_STRUCTURE, TextUtil.COMMAND, StructureCommand.UPDATE));
 
         return new StructureElementNotification(
-                StructureElementUtil.getStructureElementProcessed(system, holderStructures, StructureChoice.STRUCTURE),
+                StructureElementUtil.getStructureElementProcessed(tmpSystem, holderTmpStructures, StructureChoice.STRUCTURE),
                 NotificationUtil.prepareNotification(Type.SYSTEM, StructureCommand.UPDATE, tmpPrevious, tmpSystem, holderTmpStructures));
     }
 
     @Transactional(propagation = Propagation.MANDATORY)
     public StructureElementNotification deleteStructure(StructureElementCommand structureElementCommand, Date when, String username,
-            HolderStructures holderStructures, HolderTmpStructures holderTmpStructures) {
+            HolderTmpStructures holderTmpStructures) {
 
         // validation outside method
         // transaction
         //     support a current transaction, throw an exception if none exists
-        //     update structure - not latest
-        //     create structure - approved, latest, deleted
+        //     delete structure (update)
+        //     create audit
         //     previous for notification
         //     additional
         //         delete related names
@@ -261,60 +206,36 @@ public class SystemService {
 
         String uuid = structureElementCommand.getUuid().toString();
 
-        // update
-        List<System> systems = systemRepository.readSystems(Boolean.FALSE, uuid, null, null, null, null, null, null);
-        System system = null;
-        if (ValidateUtil.isSize(systems, 1)) {
-            system = systems.get(0);
-            system.setLatest(Boolean.FALSE);
-            systemRepository.updateSystem(system);
-        } else {
-            return null;
-        }
-
-        // create
-        system = new System(system.getUuid(), system.getParentUuid(),
-                system.getMnemonic(), system.getMnemonicEquivalence(), system.getOrdering(),
-                system.getDescription(), Status.APPROVED, Boolean.TRUE, Boolean.TRUE,
-                when, username, null);
-        systemRepository.createSystem(system);
-
-        // update tmp
+        // delete structure
         // create audit
-        // <TMP>
         TmpSystem tmpSystem = iTmpSystemRepository.findByUuid(uuid);
         tmpSystem.setDeleted(Boolean.TRUE);
         tmpSystem.setAttributesProcessed(when, username, null);
         tmpSystemRepository.updateSystem(tmpSystem);
         TmpAuditStructure tmpAuditStructure = new TmpAuditStructure(TextUtil.DELETE, tmpSystem);
         tmpAuditStructureRepository.createTmpAuditStructure(tmpAuditStructure);
-        // </TMP>
 
         // previous
-        List<System> previouses = iSystemRepository.findPreviousByUuidAndId(uuid, system.getId());
-        System previous = previouses != null && !previouses.isEmpty() ? previouses.get(0) : null;
-        // <TMP>
         TmpAuditStructure tmpPreviousAuditStructure = iTmpAuditStructureRepository.findPreviousByAuditTableAndUuidAndAuditId(Type.SYSTEM.name().toLowerCase(), uuid, tmpAuditStructure.getAuditId());
-        TmpSystem tmpPrevious = StructureUtil.convert2System(tmpPreviousAuditStructure);
-        // </TMP>
+        TmpSystem tmpPrevious = new TmpSystem(tmpPreviousAuditStructure);
 
         // additional
         //     will propagate to sub structures
-        namesService.deleteNames(system, username);
+        namesService.deleteNames(tmpSystem, username, holderTmpStructures);
 
         List<StructureElementCommand> commands = Lists.newArrayList();
-        List<Subsystem> subsystems = iSubsystemRepository.findLatestNotDeletedByParent(uuid);
-        for (Subsystem subsystem : subsystems) {
+        List<TmpSubsystem> subsystems = iTmpSubsystemRepository.findNotDeletedByParent(tmpSystem.getId());
+        for (TmpSubsystem subsystem : subsystems) {
             commands.add(new StructureElementCommand(subsystem.getUuid(), Type.SUBSYSTEM, null, null, null, null));
         }
         for (StructureElementCommand command : commands) {
-            subsystemService.deleteStructure(command, when, username, holderStructures, holderTmpStructures);
+            subsystemService.deleteStructure(command, when, username, holderTmpStructures);
         }
 
         LOGGER.log(Level.FINE, () -> MessageFormat.format(TextUtil.DESCRIPTION_NAME_VALUE, TextUtil.DELETE_STRUCTURE, TextUtil.COMMAND, StructureCommand.DELETE));
 
         return new StructureElementNotification(
-                StructureElementUtil.getStructureElementProcessed(system, holderStructures, StructureChoice.STRUCTURE),
+                StructureElementUtil.getStructureElementProcessed(tmpSystem, holderTmpStructures, StructureChoice.STRUCTURE),
                 NotificationUtil.prepareNotification(Type.SYSTEM, StructureCommand.DELETE, tmpPrevious, tmpSystem, holderTmpStructures));
     }
 
diff --git a/src/main/java/org/openepics/names/util/NameElementUtil.java b/src/main/java/org/openepics/names/util/NameElementUtil.java
index 39aeec0b..21c2f296 100644
--- a/src/main/java/org/openepics/names/util/NameElementUtil.java
+++ b/src/main/java/org/openepics/names/util/NameElementUtil.java
@@ -22,11 +22,13 @@ import java.util.Date;
 import java.util.List;
 import java.util.UUID;
 
-import org.openepics.names.repository.model.DeviceType;
-import org.openepics.names.repository.model.Name;
-import org.openepics.names.repository.model.Subsystem;
-import org.openepics.names.repository.model.System;
-import org.openepics.names.repository.model.SystemGroup;
+import org.openepics.names.repository.model.tmp.TmpAuditName;
+import org.openepics.names.repository.model.tmp.TmpDeviceType;
+import org.openepics.names.repository.model.tmp.TmpName;
+import org.openepics.names.repository.model.tmp.TmpStructure;
+import org.openepics.names.repository.model.tmp.TmpSubsystem;
+import org.openepics.names.repository.model.tmp.TmpSystem;
+import org.openepics.names.repository.model.tmp.TmpSystemGroup;
 import org.openepics.names.rest.beans.Status;
 import org.openepics.names.rest.beans.element.NameElement;
 import org.openepics.names.rest.beans.element.NameElementCommand;
@@ -60,12 +62,27 @@ public class NameElementUtil {
      * Populate and return list of name elements for list of names.
      *
      * @param names names
+     * @param holderTmpStructures container for system and device structure content
      * @return list of name elements
      */
-    public static List<NameElement> getNameElements(List<Name> names) {
+    public static List<NameElement> getNameElementsForAuditNames(List<TmpAuditName> names, HolderTmpStructures holderTmpStructures) {
         List<NameElement> nameElements = Lists.newArrayList();
-        for (Name name : names) {
-            nameElements.add(NameElementUtil.getNameElement(name));
+        for (TmpAuditName name : names) {
+            nameElements.add(NameElementUtil.getNameElement(name.getNonAuditName(), holderTmpStructures));
+        }
+        return nameElements;
+    }
+    /**
+     * Populate and return list of name elements for list of names.
+     *
+     * @param names names
+     * @param holderTmpStructures container for system and device structure content
+     * @return list of name elements
+     */
+    public static List<NameElement> getNameElements(List<TmpName> names, HolderTmpStructures holderTmpStructures) {
+        List<NameElement> nameElements = Lists.newArrayList();
+        for (TmpName name : names) {
+            nameElements.add(NameElementUtil.getNameElement(name, holderTmpStructures));
         }
         return nameElements;
     }
@@ -74,15 +91,50 @@ public class NameElementUtil {
      * Populate and return name element for name.
      *
      * @param name name
+     * @param holderTmpStructures container for system and device structure content
      * @return name element
      */
-    public static NameElement getNameElement(Name name) {
-        if (name == null) {
+    public static NameElement getNameElement(TmpName name, HolderTmpStructures holderTmpStructures) {
+        return getNameElement(name, holderTmpStructures, null);
+    }
+    /**
+     * Populate and return name element for name.
+     *
+     * @param name name
+     * @param structure (system) structure
+     * @return name element
+     */
+    public static NameElement getNameElement(TmpName name, TmpStructure structure) {
+        return getNameElement(name, null, structure);
+    }
+    /**
+     * Populate and return name element for name.
+     *
+     * @param name name
+     * @param holderTmpStructures container for system and device structure content
+     * @param structure (system) structure
+     * @return name element
+     */
+    public static NameElement getNameElement(TmpName name, HolderTmpStructures holderTmpStructures, TmpStructure structure) {
+        if (name == null || (holderTmpStructures == null && structure == null)) {
+            return null;
+        }
+        if (structure != null && !(structure instanceof TmpSystemGroup || structure instanceof TmpSystem || structure instanceof TmpSubsystem)) {
             return null;
         }
 
+        UUID parentSystemStructureUuid = null;
+        UUID parentDeviceStructureUuid = null;
+
+        if (structure != null) {
+            parentSystemStructureUuid = structure.getUuid();
+        } else {
+            parentSystemStructureUuid = getParentSystemStructureUuid(name, holderTmpStructures);
+            parentDeviceStructureUuid = name.getDeviceTypeId() != null ? holderTmpStructures.findDeviceTypeById(name.getDeviceTypeId()).getUuid() : null;
+        }
+
         return getNameElement(
-                name.getUuid(), NameUtil.getParentSystemStructure(name), name.getDeviceTypeUuid(),
+                name.getUuid(), parentSystemStructureUuid, parentDeviceStructureUuid,
                 name.getInstanceIndex(), name.getDescription(),
                 NamingConventionUtil.extractMnemonicPathSystemStructure(name.getConventionName()),
                 NamingConventionUtil.extractMnemonicPathDeviceStructure(name.getConventionName()),
@@ -91,6 +143,88 @@ public class NameElementUtil {
                 name.getRequested(), name.getRequestedBy(), name.getRequestedComment());
     }
 
+    /**
+     * Return UUID for parent system structure.
+     *
+     * @param name name
+     * @param holderTmpStructures container for system and device structure content
+     * @return uuid
+     */
+    public static UUID getParentSystemStructureUuid(TmpName name, HolderTmpStructures holderTmpStructures) {
+        return name.getSubsystemId() != null
+                ? holderTmpStructures.findSubsystemById(name.getSubsystemId()).getUuid()
+                : name.getSystemId() != null
+                    ? holderTmpStructures.findSystemById(name.getSystemId()).getUuid()
+                    : name.getSystemGroupId() != null
+                        ? holderTmpStructures.findSystemGroupById(name.getSystemGroupId()).getUuid()
+                        : null;
+    }
+
+    /**
+     * Return UUID for system group or null if non-existent.
+     *
+     * @param name name
+     * @param holderTmpStructures container for system and device structure content
+     * @return uuid
+     */
+    public static UUID getSystemGroupUuid(TmpName name, HolderTmpStructures holderTmpStructures) {
+        if (name == null || name.getSystemGroupId() == null ||  holderTmpStructures == null) {
+            return null;
+        }
+
+        return name.getSystemGroupId() != null
+                ? holderTmpStructures.findSystemGroupById(name.getSystemGroupId()).getUuid()
+                : null;
+    }
+    /**
+     * Return UUID for system or null if non-existent.
+     *
+     * @param name name
+     * @param holderTmpStructures container for system and device structure content
+     * @return uuid
+     */
+    public static UUID getSystemUuid(TmpName name, HolderTmpStructures holderTmpStructures) {
+        if (name == null || name.getSystemId() == null ||  holderTmpStructures == null) {
+            return null;
+        }
+
+        return name.getSystemId() != null
+                ? holderTmpStructures.findSystemById(name.getSystemId()).getUuid()
+                : null;
+    }
+    /**
+     * Return UUID for subsystem or null if non-existent.
+     *
+     * @param name name
+     * @param holderTmpStructures container for system and device structure content
+     * @return uuid
+     */
+    public static UUID getSubsystemUuid(TmpName name, HolderTmpStructures holderTmpStructures) {
+        if (name == null || name.getSubsystemId() == null ||  holderTmpStructures == null) {
+            return null;
+        }
+
+        return name.getSubsystemId() != null
+                ? holderTmpStructures.findSubsystemById(name.getSubsystemId()).getUuid()
+                : null;
+    }
+    /**
+     * Return UUID for device type or null if non-existent.
+     *
+     * @param name name
+     * @param holderTmpStructures container for system and device structure content
+     * @return uuid
+     */
+    public static UUID getDeviceTypeUuid(TmpName name, HolderTmpStructures holderTmpStructures) {
+        if (name == null || name.getDeviceTypeId() == null || holderTmpStructures == null) {
+            return null;
+        }
+
+        return name.getDeviceTypeId() != null
+                ? holderTmpStructures.findDeviceTypeById(name.getDeviceTypeId()).getUuid()
+                : null;
+    }
+
     /**
      * Populate and return name element.
      *
@@ -129,11 +263,11 @@ public class NameElementUtil {
      *
      * @param nameElement name element
      * @param name name
-     * @param holderIRepositories holder repositories
-     * @param holderStructures holder of system and device structure content
+     * @param holderITmpRepositories holder repositories
+     * @param holderTmpStructures holder of system and device structure content
      * @return true if name element and name have same content, false otherwise
      */
-    public static boolean hasSameContent(NameElementCommand nameElement, Name name, HolderIRepositories holderIRepositories, HolderStructures holderStructures) {
+    public static boolean hasSameContent(NameElementCommand nameElement, TmpName name, HolderITmpRepositories holderITmpRepositories, HolderTmpStructures holderTmpStructures) {
         // NameElement
         //     x parentSystemStructure (system group, system, subsystem)
         //     x parentDeviceStructure (device type)
@@ -156,21 +290,21 @@ public class NameElementUtil {
         // find out system group, system, subsystem
         //     one of the three expected to be non-null, other two expected to be null
 
-        SystemGroup systemGroup = holderIRepositories.systemGroupRepository().findLatestByUuid(nameElement.getParentSystemStructure().toString());
-        System      system      = holderIRepositories.systemRepository().findLatestByUuid(nameElement.getParentSystemStructure().toString());
-        Subsystem   subsystem   = holderIRepositories.subsystemRepository().findLatestByUuid(nameElement.getParentSystemStructure().toString());
-        DeviceType  deviceType  = null;
+        TmpSystemGroup systemGroup = holderITmpRepositories.systemGroupRepository().findByUuid(nameElement.getParentSystemStructure().toString());
+        TmpSystem      system      = holderITmpRepositories.systemRepository().findByUuid(nameElement.getParentSystemStructure().toString());
+        TmpSubsystem   subsystem   = holderITmpRepositories.subsystemRepository().findByUuid(nameElement.getParentSystemStructure().toString());
+        TmpDeviceType  deviceType  = null;
         if (nameElement.getParentDeviceStructure() != null) {
-            deviceType = holderIRepositories.deviceTypeRepository().findLatestByUuid(nameElement.getParentDeviceStructure().toString());
+            deviceType = holderITmpRepositories.deviceTypeRepository().findByUuid(nameElement.getParentDeviceStructure().toString());
         }
 
         String derivedName = null;
         if (systemGroup != null) {
-            derivedName = NameUtil.getName(systemGroup, deviceType, nameElement.getIndex(), holderStructures);
+            derivedName = NameUtil.getName(systemGroup, deviceType, nameElement.getIndex(), holderTmpStructures);
         } else if (system != null) {
-            derivedName = NameUtil.getName(system, deviceType, nameElement.getIndex(), holderStructures);
+            derivedName = NameUtil.getName(system, deviceType, nameElement.getIndex(), holderTmpStructures);
         } else if (subsystem != null) {
-            derivedName = NameUtil.getName(subsystem, deviceType, nameElement.getIndex(), holderStructures);
+            derivedName = NameUtil.getName(subsystem, deviceType, nameElement.getIndex(), holderTmpStructures);
         } else {
             return false;
         }
diff --git a/src/main/java/org/openepics/names/util/NameUtil.java b/src/main/java/org/openepics/names/util/NameUtil.java
index b049b8ac..6cdd7721 100644
--- a/src/main/java/org/openepics/names/util/NameUtil.java
+++ b/src/main/java/org/openepics/names/util/NameUtil.java
@@ -18,14 +18,8 @@
 
 package org.openepics.names.util;
 
-import java.util.UUID;
-
 import org.apache.commons.lang3.StringUtils;
-import org.openepics.names.repository.model.DeviceType;
 import org.openepics.names.repository.model.Name;
-import org.openepics.names.repository.model.Subsystem;
-import org.openepics.names.repository.model.System;
-import org.openepics.names.repository.model.SystemGroup;
 import org.openepics.names.repository.model.tmp.TmpDeviceType;
 import org.openepics.names.repository.model.tmp.TmpSubsystem;
 import org.openepics.names.repository.model.tmp.TmpSystem;
@@ -105,75 +99,6 @@ public class NameUtil {
                 : -1;
     }
 
-    /**
-     * Return UUID for parent system structure.
-     *
-     * @param name name
-     * @return uuid
-     */
-    public static UUID getParentSystemStructure(Name name) {
-        if (name == null) {
-            return null;
-        }
-
-        return name.getSubsystemUuid() != null
-                ? name.getSubsystemUuid()
-                : name.getSystemUuid() != null
-                    ? name.getSystemUuid()
-                    : name.getSystemGroupUuid() != null
-                        ? name.getSystemGroupUuid()
-                        : null;
-
-    }
-
-    /**
-     * Return convention name given system group, device type and index.
-     *
-     * @param systemGroup system group
-     * @param deviceType device type
-     * @param index index
-     * @param holderStructures container for system and device structure content
-     * @return convention name
-     */
-    public static String getName(SystemGroup systemGroup, DeviceType deviceType, String index, HolderStructures holderStructures) {
-        return getName(
-                StructureUtil.getMnemonicPath(systemGroup, holderStructures),
-                StructureUtil.getMnemonicPath(deviceType, holderStructures),
-                index);
-    }
-
-    /**
-     * Return convention name given system, device type and index.
-     *
-     * @param system
-     * @param deviceType device type
-     * @param index index
-     * @param holderStructures container for system and device structure content
-     * @return convention name
-     */
-    public static String getName(System system, DeviceType deviceType, String index, HolderStructures holderStructures) {
-        return getName(
-                StructureUtil.getMnemonicPath(system, holderStructures),
-                StructureUtil.getMnemonicPath(deviceType, holderStructures),
-                index);
-    }
-
-    /**
-     * Return convention name given subsystem, device type and index.
-     *
-     * @param subsystem
-     * @param deviceType device type
-     * @param index index
-     * @param holderStructures container for system and device structure content
-     * @return convention name
-     */
-    public static String getName(Subsystem subsystem, DeviceType deviceType, String index, HolderStructures holderStructures) {
-        return getName(
-                StructureUtil.getMnemonicPath(subsystem, holderStructures),
-                StructureUtil.getMnemonicPath(deviceType, holderStructures),
-                index);
-    }
-
     /**
      * Return convention name for system and device structure mnemonic paths and index.
      *
diff --git a/src/main/java/org/openepics/names/util/StructureElementUtil.java b/src/main/java/org/openepics/names/util/StructureElementUtil.java
index 15a18f6e..390e237d 100644
--- a/src/main/java/org/openepics/names/util/StructureElementUtil.java
+++ b/src/main/java/org/openepics/names/util/StructureElementUtil.java
@@ -28,6 +28,13 @@ import org.openepics.names.repository.model.Discipline;
 import org.openepics.names.repository.model.Subsystem;
 import org.openepics.names.repository.model.System;
 import org.openepics.names.repository.model.SystemGroup;
+import org.openepics.names.repository.model.tmp.TmpAuditStructure;
+import org.openepics.names.repository.model.tmp.TmpDeviceGroup;
+import org.openepics.names.repository.model.tmp.TmpDeviceType;
+import org.openepics.names.repository.model.tmp.TmpDiscipline;
+import org.openepics.names.repository.model.tmp.TmpSubsystem;
+import org.openepics.names.repository.model.tmp.TmpSystem;
+import org.openepics.names.repository.model.tmp.TmpSystemGroup;
 import org.openepics.names.rest.beans.Status;
 import org.openepics.names.rest.beans.Type;
 import org.openepics.names.rest.beans.element.StructureElement;
@@ -336,6 +343,361 @@ public class StructureElementUtil {
                 deviceType.getProcessed(), deviceType.getProcessedBy(), deviceType.getProcessedComment());
     }
 
+    // ----------------------------------------------------------------------------------------------------
+
+    // <TMP>
+    /**
+     * Populate and return list of structure elements for audit structures.
+     *
+     * @param auditStructures audit structures
+     * @param holderStructures holder of system and device structure content
+     * @param structureChoice whether to consider content from structure perspective or history perspective.
+     *                        Structure perspective will give mnemonic path.
+     *                        History perspective may give empty mnemonic path as non-trivial to find out for history.
+     *                        If choice not given then default as structure perspective (processed).
+     * @return list of structure elements
+     */
+    public static List<StructureElement> getStructureElementsForAuditStructures(List<TmpAuditStructure> auditStructures, HolderTmpStructures holderStructures, StructureChoice structureChoice) {
+        List<StructureElement> structureElements = Lists.newArrayList();
+        for (TmpAuditStructure auditStructure : auditStructures) {
+            structureElements.add(getStructureElementProcessed(auditStructure, holderStructures, structureChoice));
+        }
+        return structureElements;
+    }
+    /**
+     * Populate and return list of structure elements for system groups.
+     *
+     * @param systemGroups system groups
+     * @param holderStructures holder of system and device structure content
+     * @param structureChoice whether to consider content from structure perspective or history perspective.
+     *                        Structure perspective will give mnemonic path.
+     *                        History perspective may give empty mnemonic path as non-trivial to find out for history.
+     *                        If choice not given then default as structure perspective (processed).
+     * @return list of structure elements
+     */
+    public static List<StructureElement> getStructureElementsForSystemGroups(List<TmpSystemGroup> systemGroups, HolderTmpStructures holderStructures, StructureChoice structureChoice) {
+        List<StructureElement> structureElements = Lists.newArrayList();
+        for (TmpSystemGroup systemGroup : systemGroups) {
+            structureElements.add(getStructureElementProcessed(systemGroup, holderStructures, structureChoice));
+        }
+        return structureElements;
+    }
+    /**
+     * Populate and return list of structure elements for systems.
+     *
+     * @param systems systems
+     * @param holderStructures holder of system and device structure content
+     * @param structureChoice whether to consider content from structure perspective or history perspective.
+     *                        Structure perspective will give mnemonic path.
+     *                        History perspective may give empty mnemonic path as non-trivial to find out for history.
+     *                        If choice not given then default as structure perspective (processed).
+     * @return list of structure elements
+     */
+    public static List<StructureElement> getStructureElementsForSystems(List<TmpSystem> systems, HolderTmpStructures holderStructures, StructureChoice structureChoice) {
+        List<StructureElement> structureElements = Lists.newArrayList();
+        for (TmpSystem system : systems) {
+            structureElements.add(getStructureElementProcessed(system, holderStructures, structureChoice));
+        }
+        return structureElements;
+    }
+    /**
+     * Populate and return list of structure elements for subsystems.
+     *
+     * @param subsystems subsystems
+     * @param holderStructures holder of system and device structure content
+     * @param structureChoice whether to consider content from structure perspective or history perspective.
+     *                        Structure perspective will give mnemonic path.
+     *                        History perspective may give empty mnemonic path as non-trivial to find out for history.
+     *                        If choice not given then default as structure perspective (processed).
+     * @return list of structure elements
+     */
+    public static List<StructureElement> getStructureElementsForSubsystems(List<TmpSubsystem> subsystems, HolderTmpStructures holderStructures, StructureChoice structureChoice) {
+        List<StructureElement> structureElements = Lists.newArrayList();
+        for (TmpSubsystem subsystem : subsystems) {
+            structureElements.add(getStructureElementProcessed(subsystem, holderStructures, structureChoice));
+        }
+        return structureElements;
+    }
+
+    /**
+     * Populate and return list of structure elements for disciplines.
+     *
+     * @param disciplines disciplines
+     * @param holderStructures holder of system and device structure content
+     * @param structureChoice whether to consider content from structure perspective or history perspective.
+     *                        Structure perspective will give mnemonic path.
+     *                        History perspective may give empty mnemonic path as non-trivial to find out for history.
+     *                        If choice not given then default as structure perspective (processed).
+     * @return list of structure elements
+     */
+    public static List<StructureElement> getStructureElementsForDisciplines(List<TmpDiscipline> disciplines, HolderTmpStructures holderStructures, StructureChoice structureChoice) {
+        List<StructureElement> structureElements = Lists.newArrayList();
+        for (TmpDiscipline discipline : disciplines) {
+            structureElements.add(getStructureElementProcessed(discipline, holderStructures, structureChoice));
+        }
+        return structureElements;
+    }
+    /**
+     * Populate and return list of structure elements for device groups.
+     *
+     * @param deviceGroups device groups
+     * @param holderStructures holder of system and device structure content
+     * @param structureChoice whether to consider content from structure perspective or history perspective.
+     *                        Structure perspective will give mnemonic path.
+     *                        History perspective may give empty mnemonic path as non-trivial to find out for history.
+     *                        If choice not given then default as structure perspective (processed).
+     * @return list of structure elements
+     */
+    public static List<StructureElement> getStructureElementsForDeviceGroups(List<TmpDeviceGroup> deviceGroups, HolderTmpStructures holderStructures, StructureChoice structureChoice) {
+        List<StructureElement> structureElements = Lists.newArrayList();
+        for (TmpDeviceGroup deviceGroup : deviceGroups) {
+            structureElements.add(getStructureElementProcessed(deviceGroup, holderStructures, structureChoice));
+        }
+        return structureElements;
+    }
+    /**
+     * Populate and return list of structure elements for device types.
+     *
+     * @param deviceTypes device types
+     * @param holderStructures holder of system and device structure content
+     * @param structureChoice whether to consider content from structure perspective or history perspective.
+     *                        Structure perspective will give mnemonic path.
+     *                        History perspective may give empty mnemonic path as non-trivial to find out for history.
+     *                        If choice not given then default as structure perspective (processed).
+     * @return list of structure elements
+     */
+    public static List<StructureElement> getStructureElementsForDeviceTypes(List<TmpDeviceType> deviceTypes, HolderTmpStructures holderStructures, StructureChoice structureChoice) {
+        List<StructureElement> structureElements = Lists.newArrayList();
+        for (TmpDeviceType deviceType : deviceTypes) {
+            structureElements.add(getStructureElementProcessed(deviceType, holderStructures, structureChoice));
+        }
+        return structureElements;
+    }
+
+    /**
+     * Populate and return structure element for audit structure with focus on processed.
+     *
+     * @param auditStructure audit structure
+     * @param holderStructures holder of system and device structure content
+     * @param structureChoice whether to consider content from structure perspective or history perspective
+     * @return structure element
+     */
+    public static StructureElement getStructureElementProcessed(TmpAuditStructure auditStructure, HolderTmpStructures holderStructures, StructureChoice structureChoice) {
+        if (auditStructure == null) {
+            return null;
+        }
+
+        // find out attributes as audit table is shared for system and device structure content
+        //     mnemonic path ambiguous if considered in past
+        Type type = null;
+        UUID parent = null;
+        String mnemonicPath = null;
+        Integer level = null;
+
+        if (TextUtil.SYSTEMGROUP.equals(auditStructure.getAuditTable())) {
+            type = Type.SYSTEMGROUP;
+            level = 1;
+        } else if (TextUtil.SYSTEM.equals(auditStructure.getAuditTable())) {
+            type = Type.SYSTEM;
+            parent = holderStructures.findSystemGroupById(auditStructure.getParentId()).getUuid();
+            level = 2;
+        } else if (TextUtil.SUBSYSTEM.equals(auditStructure.getAuditTable())) {
+            type = Type.SUBSYSTEM;
+            parent = holderStructures.findSystemById(auditStructure.getParentId()).getUuid();
+            level = 3;
+        } else if (TextUtil.DISCIPLINE.equals(auditStructure.getAuditTable())) {
+            type = Type.DISCIPLINE;
+            level = 1;
+        } else if (TextUtil.DEVICEGROUP.equals(auditStructure.getAuditTable())) {
+            type = Type.DEVICEGROUP;
+            parent = holderStructures.findDisciplineById(auditStructure.getParentId()).getUuid();
+            level = 2;
+        } else if (TextUtil.DEVICETYPE.equals(auditStructure.getAuditTable())) {
+            type = Type.DEVICETYPE;
+            parent = holderStructures.findDeviceGroupById(auditStructure.getParentId()).getUuid();
+            level = 3;
+        }
+
+        return getStructureElement(
+                auditStructure.getUuid(), type, parent,
+                auditStructure.getMnemonic(), auditStructure.getOrdering(), auditStructure.getDescription(),
+                mnemonicPath, level,
+                auditStructure.getStatus(), auditStructure.isDeleted(),
+                auditStructure.getProcessed(), auditStructure.getProcessedBy(), auditStructure.getProcessedComment());
+    }
+    /**
+     * Populate and return structure element for system group with focus on processed.
+     *
+     * @param systemGroup system group
+     * @param holderStructures holder of system and device structure content
+     * @param structureChoice whether to consider content from structure perspective or history perspective
+     * @return structure element
+     */
+    public static StructureElement getStructureElementProcessed(TmpSystemGroup systemGroup, HolderTmpStructures holderStructures, StructureChoice structureChoice) {
+        if (systemGroup == null) {
+            return null;
+        }
+
+        // mnemonic path
+        //     ambiguous if considered in past (requested, processed)
+        //     not history of structure
+        //     latest & approved status
+        String mnemonicPath = StructureChoice.HISTORY.equals(structureChoice) || !Status.APPROVED.equals(systemGroup.getStatus())
+                ? null
+                : StructureUtil.getMnemonicPath(systemGroup, holderStructures);
+
+        return getStructureElement(
+                systemGroup.getUuid(), Type.SYSTEMGROUP, null,
+                systemGroup.getMnemonic(), systemGroup.getOrdering(), systemGroup.getDescription(),
+                mnemonicPath, 1,
+                systemGroup.getStatus(), systemGroup.isDeleted(),
+                systemGroup.getProcessed(), systemGroup.getProcessedBy(), systemGroup.getProcessedComment());
+    }
+    /**
+     * Populate and return structure element for system with focus on processed.
+     *
+     * @param system system
+     * @param holderStructures holder of system and device structure content
+     * @param structureChoice whether to consider content from structure perspective or history perspective
+     * @return structure element
+     */
+    public static StructureElement getStructureElementProcessed(TmpSystem system, HolderTmpStructures holderStructures, StructureChoice structureChoice) {
+        if (system == null) {
+            return null;
+        }
+
+        // mnemonic path
+        //     ambiguous if considered in past (requested, processed)
+        //     not history of structure
+        //     latest & approved status
+        String mnemonicPath = StructureChoice.HISTORY.equals(structureChoice) || !Status.APPROVED.equals(system.getStatus())
+                ? null
+                : StructureUtil.getMnemonicPath(system, holderStructures);
+
+        return getStructureElement(
+                system.getUuid(), Type.SYSTEM,   holderStructures.findSystemGroupById(system.getParentId()).getUuid(),
+                system.getMnemonic(), system.getOrdering(), system.getDescription(),
+                mnemonicPath, 2,
+                system.getStatus(), system.isDeleted(),
+                system.getProcessed(), system.getProcessedBy(), system.getProcessedComment());
+    }
+    /**
+     * Populate and return structure element for subsystem with focus on processed.
+     *
+     * @param subsystem subsystem
+     * @param holderStructures holder of system and device structure content
+     * @param structureChoice whether to consider content from structure perspective or history perspective
+     * @return structure element
+     */
+    public static StructureElement getStructureElementProcessed(TmpSubsystem subsystem, HolderTmpStructures holderStructures, StructureChoice structureChoice) {
+        if (subsystem == null) {
+            return null;
+        }
+
+        // mnemonic path
+        //     ambiguous if considered in past (requested, processed)
+        //     not history of structure
+        //     latest & approved status
+        String mnemonicPath = StructureChoice.HISTORY.equals(structureChoice) || !Status.APPROVED.equals(subsystem.getStatus())
+                ? null
+                : StructureUtil.getMnemonicPath(subsystem, holderStructures);
+
+        return getStructureElement(
+                subsystem.getUuid(), Type.SUBSYSTEM, holderStructures.findSystemById(subsystem.getParentId()).getUuid(),
+                subsystem.getMnemonic(), subsystem.getOrdering(), subsystem.getDescription(),
+                mnemonicPath, 3,
+                subsystem.getStatus(), subsystem.isDeleted(),
+                subsystem.getProcessed(), subsystem.getProcessedBy(), subsystem.getProcessedComment());
+    }
+
+    /**
+     * Populate and return structure element for discipline with focus on processed.
+     *
+     * @param discipline discipline
+     * @param holderStructures holder of system and device structure content
+     * @param structureChoice whether to consider content from structure perspective or history perspective
+     * @return structure element
+     */
+    public static StructureElement getStructureElementProcessed(TmpDiscipline discipline, HolderTmpStructures holderStructures, StructureChoice structureChoice) {
+        if (discipline == null) {
+            return null;
+        }
+
+        // mnemonic path
+        //     ambiguous if considered in past (requested, processed)
+        //     not history of structure
+        //     latest & approved status
+        String mnemonicPath = StructureChoice.HISTORY.equals(structureChoice) || !Status.APPROVED.equals(discipline.getStatus())
+                ? null
+                : StructureUtil.getMnemonicPath(discipline, holderStructures);
+
+        return getStructureElement(
+                discipline.getUuid(), Type.DISCIPLINE, null,
+                discipline.getMnemonic(), discipline.getOrdering(), discipline.getDescription(),
+                mnemonicPath, 1,
+                discipline.getStatus(), discipline.isDeleted(),
+                discipline.getProcessed(), discipline.getProcessedBy(), discipline.getProcessedComment());
+    }
+    /**
+     * Populate and return structure element for device group with focus on processed.
+     *
+     * @param deviceGroup device group
+     * @param holderStructures holder of system and device structure content
+     * @param structureChoice whether to consider content from structure perspective or history perspective
+     * @return structure element
+     */
+    public static StructureElement getStructureElementProcessed(TmpDeviceGroup deviceGroup, HolderTmpStructures holderStructures, StructureChoice structureChoice) {
+        if (deviceGroup == null) {
+            return null;
+        }
+
+        // mnemonic path
+        //     ambiguous if considered in past (requested, processed)
+        //     not history of structure
+        //     latest & approved status
+        String mnemonicPath = StructureChoice.HISTORY.equals(structureChoice) || !Status.APPROVED.equals(deviceGroup.getStatus())
+                ? null
+                : StructureUtil.getMnemonicPath(deviceGroup, holderStructures);
+
+        return getStructureElement(
+                deviceGroup.getUuid(), Type.DEVICEGROUP, holderStructures.findDisciplineById(deviceGroup.getParentId()).getUuid(),
+                deviceGroup.getMnemonic(), deviceGroup.getOrdering(), deviceGroup.getDescription(),
+                mnemonicPath, 2,
+                deviceGroup.getStatus(), deviceGroup.isDeleted(),
+                deviceGroup.getProcessed(), deviceGroup.getProcessedBy(), deviceGroup.getProcessedComment());
+    }
+    /**
+     * Populate and return structure element for device type with focus on processed.
+     *
+     * @param deviceType device type
+     * @param holderStructures holder of system and device structure content
+     * @param structureChoice whether to consider content from structure perspective or history perspective
+     * @return structure element
+     */
+    public static StructureElement getStructureElementProcessed(TmpDeviceType deviceType, HolderTmpStructures holderStructures, StructureChoice structureChoice) {
+        if (deviceType == null) {
+            return null;
+        }
+
+        // mnemonic path
+        //     ambiguous if considered in past (requested, processed)
+        //     not history of structure
+        //     latest & approved status
+        String mnemonicPath = StructureChoice.HISTORY.equals(structureChoice) || !Status.APPROVED.equals(deviceType.getStatus())
+                ? null
+                : StructureUtil.getMnemonicPath(deviceType, holderStructures);
+
+        return getStructureElement(
+                deviceType.getUuid(), Type.DEVICETYPE, holderStructures.findDeviceGroupById(deviceType.getParentId()).getUuid(),
+                deviceType.getMnemonic(), deviceType.getOrdering(), deviceType.getDescription(),
+                mnemonicPath, 3,
+                deviceType.getStatus(), deviceType.isDeleted(),
+                deviceType.getProcessed(), deviceType.getProcessedBy(), deviceType.getProcessedComment());
+    }
+    // </TMP>
+
+    // ----------------------------------------------------------------------------------------------------
+
     /**
      * Populate and return structure element.
      *
diff --git a/src/main/java/org/openepics/names/util/StructureUtil.java b/src/main/java/org/openepics/names/util/StructureUtil.java
index 3c10c71c..84c41b4e 100644
--- a/src/main/java/org/openepics/names/util/StructureUtil.java
+++ b/src/main/java/org/openepics/names/util/StructureUtil.java
@@ -560,79 +560,4 @@ public class StructureUtil {
         return listUuid;
     }
 
-    // --------------------------------------------------
-
-    /**
-     * Convert an audit structure entry to a system group entry.
-     *
-     * @param tmpAuditStructure audit structure entry
-     * @return system group
-     */
-    public static TmpSystemGroup convert2SystemGroup(TmpAuditStructure tmpAuditStructure) {
-        return new TmpSystemGroup(tmpAuditStructure.getUuid(),
-                tmpAuditStructure.getMnemonic(), tmpAuditStructure.getMnemonicEquivalence(), tmpAuditStructure.getOrdering(), tmpAuditStructure.getDescription(),
-                tmpAuditStructure.getStatus(), tmpAuditStructure.isDeleted(),
-                tmpAuditStructure.getProcessed(), tmpAuditStructure.getProcessedBy(), tmpAuditStructure.getProcessedComment());
-    }
-    /**
-     * Convert an audit structure entry to a system entry.
-     *
-     * @param tmpAuditStructure audit structure entry
-     * @return system
-     */
-    public static TmpSystem convert2System(TmpAuditStructure tmpAuditStructure) {
-        return new TmpSystem(tmpAuditStructure.getUuid(), tmpAuditStructure.getParentId(),
-                tmpAuditStructure.getMnemonic(), tmpAuditStructure.getMnemonicEquivalence(), tmpAuditStructure.getOrdering(), tmpAuditStructure.getDescription(),
-                tmpAuditStructure.getStatus(), tmpAuditStructure.isDeleted(),
-                tmpAuditStructure.getProcessed(), tmpAuditStructure.getProcessedBy(), tmpAuditStructure.getProcessedComment());
-    }
-    /**
-     * Convert an audit structure entry to a subsystem entry.
-     *
-     * @param tmpAuditStructure audit structure entry
-     * @return subsystem
-     */
-    public static TmpSubsystem convert2Subsystem(TmpAuditStructure tmpAuditStructure) {
-        return new TmpSubsystem(tmpAuditStructure.getUuid(), tmpAuditStructure.getParentId(),
-                tmpAuditStructure.getMnemonic(), tmpAuditStructure.getMnemonicEquivalence(), tmpAuditStructure.getOrdering(), tmpAuditStructure.getDescription(),
-                tmpAuditStructure.getStatus(), tmpAuditStructure.isDeleted(),
-                tmpAuditStructure.getProcessed(), tmpAuditStructure.getProcessedBy(), tmpAuditStructure.getProcessedComment());
-    }
-    /**
-     * Convert an audit structure entry to a discipline entry.
-     *
-     * @param tmpAuditStructure audit structure entry
-     * @return discipline
-     */
-    public static TmpDiscipline convert2Discipline(TmpAuditStructure tmpAuditStructure) {
-        return new TmpDiscipline(tmpAuditStructure.getUuid(),
-                tmpAuditStructure.getMnemonic(), tmpAuditStructure.getMnemonicEquivalence(), tmpAuditStructure.getOrdering(), tmpAuditStructure.getDescription(),
-                tmpAuditStructure.getStatus(), tmpAuditStructure.isDeleted(),
-                tmpAuditStructure.getProcessed(), tmpAuditStructure.getProcessedBy(), tmpAuditStructure.getProcessedComment());
-    }
-    /**
-     * Convert an audit structure entry to a device group entry.
-     *
-     * @param tmpAuditStructure audit structure entry
-     * @return device group
-     */
-    public static TmpDeviceGroup convert2DeviceGroup(TmpAuditStructure tmpAuditStructure) {
-        return new TmpDeviceGroup(tmpAuditStructure.getUuid(), tmpAuditStructure.getParentId(),
-                tmpAuditStructure.getMnemonic(), tmpAuditStructure.getMnemonicEquivalence(), tmpAuditStructure.getOrdering(), tmpAuditStructure.getDescription(),
-                tmpAuditStructure.getStatus(), tmpAuditStructure.isDeleted(),
-                tmpAuditStructure.getProcessed(), tmpAuditStructure.getProcessedBy(), tmpAuditStructure.getProcessedComment());
-    }
-    /**
-     * Convert an audit structure entry to a device type entry.
-     *
-     * @param tmpAuditStructure audit structure entry
-     * @return device type
-     */
-    public static TmpDeviceType convert2DeviceType(TmpAuditStructure tmpAuditStructure) {
-        return new TmpDeviceType(tmpAuditStructure.getUuid(), tmpAuditStructure.getParentId(),
-                tmpAuditStructure.getMnemonic(), tmpAuditStructure.getMnemonicEquivalence(), tmpAuditStructure.getOrdering(), tmpAuditStructure.getDescription(),
-                tmpAuditStructure.getStatus(), tmpAuditStructure.isDeleted(),
-                tmpAuditStructure.getProcessed(), tmpAuditStructure.getProcessedBy(), tmpAuditStructure.getProcessedComment());
-    }
-
 }
diff --git a/src/main/java/org/openepics/names/util/notification/NotificationScheduler.java b/src/main/java/org/openepics/names/util/notification/NotificationScheduler.java
index aa7a1afa..82ed5347 100644
--- a/src/main/java/org/openepics/names/util/notification/NotificationScheduler.java
+++ b/src/main/java/org/openepics/names/util/notification/NotificationScheduler.java
@@ -138,9 +138,7 @@ public class NotificationScheduler {
 
             // compare
             for (int i=0; i<extracted.size(); i++) {
-                // created - no previous
-                // updated - is not latest
-                // deleted - is latest and is deleted
+                // find out what kind of change (may also use audit fields)
                 TmpAuditName name = extracted.get(i);
                 if (i == 0 && index == 0) {
                     NotificationUtil.prepareAddNotification(created, NameCommand.CREATE, null, name);
diff --git a/src/test/java/org/openepics/names/util/NameElementUtilTest.java b/src/test/java/org/openepics/names/util/NameElementUtilTest.java
index 9d5fccea..9916c040 100644
--- a/src/test/java/org/openepics/names/util/NameElementUtilTest.java
+++ b/src/test/java/org/openepics/names/util/NameElementUtilTest.java
@@ -26,7 +26,8 @@ import java.util.Date;
 import java.util.UUID;
 
 import org.junit.jupiter.api.Test;
-import org.openepics.names.repository.model.Name;
+import org.openepics.names.repository.model.tmp.TmpName;
+import org.openepics.names.repository.model.tmp.TmpStructure;
 import org.openepics.names.rest.beans.Status;
 import org.openepics.names.rest.beans.element.NameElement;
 import org.openepics.names.rest.beans.element.NameElementCommand;
@@ -48,26 +49,20 @@ class NameElementUtilTest {
      */
     @Test
     void getNameElement() {
-        NameElement nameElement = NameElementUtil.getNameElement(null);
-        assertNull(nameElement);
+        TmpName name = null;
+        HolderTmpStructures holderTmpStructures = null;
+        TmpStructure tmpStructure = null;
 
-        Name name = new Name();
-        nameElement = NameElementUtil.getNameElement(name);
+        NameElement nameElement = NameElementUtil.getNameElement(name, holderTmpStructures);
+        assertNull(nameElement);
+        nameElement = NameElementUtil.getNameElement(name, tmpStructure);
+        assertNull(nameElement);
 
-        assertNotNull(nameElement);
-        assertEquals(null, nameElement.getUuid());
-        assertEquals(null, nameElement.getParentSystemStructure());
-        assertEquals(null, nameElement.getParentDeviceStructure());
-        assertEquals(null, nameElement.getSystemStructure());
-        assertEquals(null, nameElement.getDeviceStructure());
-        assertEquals(null, nameElement.getIndex());
-        assertEquals(null, nameElement.getName());
-        assertEquals(null, nameElement.getDescription());
-        assertEquals(Status.APPROVED, nameElement.getStatus());
-        assertEquals(null, nameElement.isDeleted());
-        assertEquals(null, nameElement.getWhen());
-        assertEquals(null, nameElement.getWho());
-        assertEquals(null, nameElement.getComment());
+        name = new TmpName();
+        nameElement = NameElementUtil.getNameElement(name, holderTmpStructures);
+        assertNull(nameElement);
+        nameElement = NameElementUtil.getNameElement(name, tmpStructure);
+        assertNull(nameElement);
     }
 
     /**
diff --git a/src/test/java/org/openepics/names/util/NameUtilTest.java b/src/test/java/org/openepics/names/util/NameUtilTest.java
index d690f2ee..8a64f9b6 100644
--- a/src/test/java/org/openepics/names/util/NameUtilTest.java
+++ b/src/test/java/org/openepics/names/util/NameUtilTest.java
@@ -19,7 +19,6 @@
 package org.openepics.names.util;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
 
 import java.util.UUID;
 
@@ -93,61 +92,6 @@ class NameUtilTest {
         assertEquals(3, NameUtil.getLevelDeviceStructure(name));
     }
 
-    /**
-     * Test of get level of device structure for name.
-     */
-    @Test
-    void getParentSystemStructure() {
-        assertNull(NameUtil.getParentSystemStructure(null));
-
-        Name name = new Name();
-        assertNull(NameUtil.getParentSystemStructure(name));
-
-        name.setSystemGroupUuid(null);
-        name.setSystemUuid(null);
-        name.setSubsystemUuid(null);
-        assertNull(NameUtil.getParentSystemStructure(name));
-
-        UUID uuid1 = UUID.randomUUID();
-        name.setSystemGroupUuid(uuid1);
-        name.setSystemUuid(null);
-        name.setSubsystemUuid(null);
-        assertEquals(uuid1, NameUtil.getParentSystemStructure(name));
-
-        name.setSystemGroupUuid(null);
-        name.setSystemUuid(uuid1);
-        name.setSubsystemUuid(null);
-        assertEquals(uuid1, NameUtil.getParentSystemStructure(name));
-
-        name.setSystemGroupUuid(null);
-        name.setSystemUuid(null);
-        name.setSubsystemUuid(uuid1);
-        assertEquals(uuid1, NameUtil.getParentSystemStructure(name));
-
-        // cases below should not happen but test anyway
-        UUID uuid2 = UUID.randomUUID();
-        UUID uuid3 = UUID.randomUUID();
-        name.setSystemGroupUuid(uuid1);
-        name.setSystemUuid(uuid2);
-        name.setSubsystemUuid(uuid3);
-        assertEquals(uuid3, NameUtil.getParentSystemStructure(name));
-
-        name.setSystemGroupUuid(uuid1);
-        name.setSystemUuid(uuid2);
-        name.setSubsystemUuid(null);
-        assertEquals(uuid2, NameUtil.getParentSystemStructure(name));
-
-        name.setSystemGroupUuid(null);
-        name.setSystemUuid(uuid2);
-        name.setSubsystemUuid(uuid3);
-        assertEquals(uuid3, NameUtil.getParentSystemStructure(name));
-
-        name.setSystemGroupUuid(uuid1);
-        name.setSystemUuid(null);
-        name.setSubsystemUuid(uuid3);
-        assertEquals(uuid3, NameUtil.getParentSystemStructure(name));
-    }
-
     /**
      * Test of get convention name for system and device structure mnemonic paths and index.
      */
@@ -165,4 +109,5 @@ class NameUtilTest {
     void getName(String systemStructure, String deviceStructure, String index, String expected) {
         assertEquals(expected, NameUtil.getName(systemStructure, deviceStructure, index));
     }
+
 }
-- 
GitLab