diff --git a/btypes_primitives/src/main/rust_embedded/btypes/src/brelation.rs b/btypes_primitives/src/main/rust_embedded/btypes/src/brelation.rs
index fd3811bdfff11a4ea970566f29d6563ccb6ac07a..105a537acf6bdeed817cada102479dcceade9ace 100644
--- a/btypes_primitives/src/main/rust_embedded/btypes/src/brelation.rs
+++ b/btypes_primitives/src/main/rust_embedded/btypes/src/brelation.rs
@@ -164,7 +164,7 @@ impl<L, const LS: usize, R, const RS: usize, const REL_SIZE: usize> BRelation<L,
         let mut checked = BSet::<R, RS>::empty(); //stores all the R's that were already 'used'
         for to_check in self.rel.iter().cloned().map(|arr| BSet::<R, RS>::const_from_arr(arr)) {
             if !checked.intersect(&to_check).is_empty() { return false; }
-            checked = checked._union(&to_check);
+            checked = checked.union(&to_check);
         }
         return true;
     }
@@ -270,7 +270,7 @@ impl<L, const LS: usize, R, const RS: usize, const REL_SIZE: usize> BRelation<L,
         return self.relation_combine(other, |s, o| s && !o);
     }
 
-    pub fn _union(&self, other: &Self) -> Self {
+    pub fn union(&self, other: &Self) -> Self {
         return self.relation_combine(other, |s, o| s | o);
     }
 
@@ -382,7 +382,7 @@ where L: SetItem<LS> {
     }
 
     pub fn iterate(&self, n: &BInteger) -> Self {
-        return (0..*n).fold(BRelation::identity(&self.domain()._union(&self.range())),
+        return (0..*n).fold(BRelation::identity(&self.domain().union(&self.range())),
                                      |rel, _| rel.composition(self));
     }
 
@@ -393,11 +393,11 @@ where L: SetItem<LS> {
     fn closure_closure1(&self, is_closure1: bool) -> Self {
         let mut result = if is_closure1 { Self::empty() } else { self.iterate(&0) };
         let mut current_iteration = self.iterate(&1);
-        let mut next_result = result._union(&current_iteration);
+        let mut next_result = result.union(&current_iteration);
         while !result.equal(&next_result) {
             result = next_result;
             current_iteration = current_iteration.composition(self);
-            next_result = result._union(&current_iteration);
+            next_result = result.union(&current_iteration);
         }
         return result;
     }
diff --git a/btypes_primitives/src/main/rust_embedded/btypes/src/bset.rs b/btypes_primitives/src/main/rust_embedded/btypes/src/bset.rs
index 8826b2e7076713dbb73f3dedbb02e7d69c52a18c..84f2a9685aa5a14d6427e4809add708cfd729af8 100644
--- a/btypes_primitives/src/main/rust_embedded/btypes/src/bset.rs
+++ b/btypes_primitives/src/main/rust_embedded/btypes/src/bset.rs
@@ -183,7 +183,7 @@ impl<I: SetItem<SIZE>, const SIZE: usize> BSet<I, SIZE> {
     pub fn notSubset(&self, other: &Self) -> BBoolean { !self.subset_of(other) }
     pub fn strictNotSubset(&self, other: &Self) -> BBoolean { self.card() >= other.card() || self.notSubset(other) }
 
-    pub fn _union(&self, other: &Self) -> Self {
+    pub fn union(&self, other: &Self) -> Self {
         let mut result = self.copy();
         for i in 0..SIZE {
             if other.arr[i] { result.arr[i] = true; }
@@ -241,7 +241,7 @@ impl<I: SetItem<SIZE>, const SIZE: usize> BSet<I, SIZE> {
 
     pub const fn unequalStruct(&self) -> BBoolean { true }
 
-    pub const fn subsetOfString(&self) -> BBoolean { !todo!() }
+    pub const fn subsetOfString(&self) -> BBoolean { false } //TODO?
 
     pub const fn strictSubsetOfString(&self) -> BBoolean { return self.subsetOfString(); }
 
@@ -277,16 +277,22 @@ impl<I: SetItem<SIZE>, const SIZE: usize> BSet<I, SIZE> {
         return self.equal(&of.domain());
     }
 }
-
-trait NestedSet<const OUTER_SIZE: usize, const INNER_SIZE: usize>: Set<OUTER_SIZE> {
-    type InnerSet: Set<INNER_SIZE> + SetItem<INNER_SIZE>;
-
-    fn unary__union(&self) -> BSet<Self::InnerSet, INNER_SIZE> { self.unary__combine(|l, r| l || r) }
-    fn unary__intersect(&self) -> BSet<Self::InnerSet, INNER_SIZE> { self.unary__combine(|l, r| l && r) }
-    fn unary__combine(&self, comb_fn: fn(left_bool:bool, right_bool: bool) -> bool) -> BSet<Self::InnerSet, INNER_SIZE>;
+/*
+EINT: SetItem<4> + PowSetItem<16, 4>
+BSet<EINT, 4>: Set<4> + SetItem<16>
+BSet<BSet<Enit, 4>, 16>: Set<16>
+*/
+
+pub trait NestedSet<const OUTER_SIZE: usize, const INNER_SIZE: usize>
+where Self: Set<OUTER_SIZE>,
+      Self::ItemType: Set<INNER_SIZE> + SetItem<OUTER_SIZE> {
+
+    fn unary_union(&self) -> Self::ItemType { self.unary_combine(|l, r| l || r) }
+    fn unary_intersect(&self) -> Self::ItemType { self.unary_combine(|l, r| l && r) }
+    fn unary_combine(&self, comb_fn: fn(left_bool:bool, right_bool: bool) -> bool) -> Self::ItemType;
 }
 
-/// Implements functions for netsted-Sets.
+/// Implements functions for nested-Sets.
 /// A nested-Set is still just a 1D-array, but the Set-Item implements the Set-trait,
 /// so the index can be converted to another 1D-array (this then being the representation of the inners Sets)
 ///
@@ -296,10 +302,9 @@ trait NestedSet<const OUTER_SIZE: usize, const INNER_SIZE: usize>: Set<OUTER_SIZ
 /// (This will ulitmately only apply to BSets where the inner-type is also a BSet.)
 impl<const OUTER_SIZE: usize, const INNER_SIZE: usize, I> NestedSet<OUTER_SIZE, INNER_SIZE> for I
 where I: Set<OUTER_SIZE>,
-      I::ItemType: Set<INNER_SIZE> + SetItem<INNER_SIZE>{
-    type InnerSet = I::ItemType;
+      I::ItemType: Set<INNER_SIZE> + SetItem<OUTER_SIZE>{
 
-    fn unary__combine(&self, comb_fn: fn(left_bool:bool, right_bool: bool) -> bool) -> BSet<Self::InnerSet, INNER_SIZE> {
+    fn unary_combine(&self, comb_fn: fn(left_bool:bool, right_bool: bool) -> bool) -> I::ItemType {
         let mut result_arr = [false; INNER_SIZE]; // empty array representation of the inner settype
         for outer_idx in 0..OUTER_SIZE {
             if self.contains_idx(outer_idx) {
@@ -307,7 +312,7 @@ where I: Set<OUTER_SIZE>,
                 for inner_idx in 0..INNER_SIZE { result_arr[inner_idx] = comb_fn(result_arr[inner_idx], inner_set_arr[inner_idx]); } // logical combination between the arrays (or = union; and = intersection between sets)
             }
         }
-        return BSet::<Self::InnerSet, INNER_SIZE>::const_from_arr(result_arr);
+        return I::ItemType::from_arr(result_arr);
     }
 }
 
diff --git a/src/main/java/de/hhu/stups/codegenerator/generators/MachineGenerator.java b/src/main/java/de/hhu/stups/codegenerator/generators/MachineGenerator.java
index 15e8c808e451b699564c582435b702b096d5e85e..3b3df434a7f62344e32372ec918471019648f18e 100755
--- a/src/main/java/de/hhu/stups/codegenerator/generators/MachineGenerator.java
+++ b/src/main/java/de/hhu/stups/codegenerator/generators/MachineGenerator.java
@@ -149,9 +149,9 @@ public class MachineGenerator implements AbstractVisitor<String, Void> {
 
 	public MachineGenerator(GeneratorMode mode, boolean useBigInteger, String minint, String maxint, String deferredSetSize,
 							boolean forModelChecking, boolean useConstraintSolving, Path addition, boolean isIncludedMachine,
-							boolean forVisualisation, String serverLink, boolean embedded) {
+							boolean forVisualisation, String serverLink, boolean forEmbedded) {
 		this.mode = mode;
-		this.currentGroup = CodeGeneratorUtils.getGroup(mode, embedded);
+		this.currentGroup = CodeGeneratorUtils.getGroup(mode, forEmbedded);
 		this.forModelChecking = forModelChecking;
 		this.forVisualisation = forVisualisation;
 		this.useBigInteger = useBigInteger;
@@ -167,7 +167,7 @@ public class MachineGenerator implements AbstractVisitor<String, Void> {
 		this.setDefinitions = new SetDefinitions(currentGroup.getInstanceOf("relation_name"));
 		this.nameHandler = new NameHandler(this, currentGroup);
 		this.parallelConstructHandler = new ParallelConstructHandler();
-		this.typeGenerator = new TypeGenerator(currentGroup, nameHandler, this, setDefinitions);
+		this.typeGenerator = new TypeGenerator(currentGroup, nameHandler, this, setDefinitions, forEmbedded);
 		this.importGenerator = new ImportGenerator(currentGroup, nameHandler, useBigInteger);
 		this.backtrackingGenerator = new BacktrackingGenerator(currentGroup);
 		this.iterationConstructHandler = new IterationConstructHandler(currentGroup, this, nameHandler, typeGenerator, importGenerator, backtrackingGenerator, useConstraintSolving);
diff --git a/src/main/java/de/hhu/stups/codegenerator/generators/TypeGenerator.java b/src/main/java/de/hhu/stups/codegenerator/generators/TypeGenerator.java
index 4bcf7290f67e91ea03d211aae43909db508b0099..039835d4399dd202b0fb46aa257730c2e520b040 100644
--- a/src/main/java/de/hhu/stups/codegenerator/generators/TypeGenerator.java
+++ b/src/main/java/de/hhu/stups/codegenerator/generators/TypeGenerator.java
@@ -39,13 +39,15 @@ public class TypeGenerator {
     private final SetDefinitions setDefinitions;
 
     private boolean fromOutside = false;
+    private boolean forEmbedded = false;
 
-    public TypeGenerator(final STGroup group, final NameHandler nameHandler, final MachineGenerator machineGenerator, final SetDefinitions setDefinitions) {
+    public TypeGenerator(final STGroup group, final NameHandler nameHandler, final MachineGenerator machineGenerator, final SetDefinitions setDefinitions, boolean forEmbedded) {
         this.group = group;
         this.nameHandler = nameHandler;
         this.machineGenerator = machineGenerator;
         this.setDefinitions = setDefinitions;
         this.declarationGenerator = null;
+        this.forEmbedded = forEmbedded;
     }
 
     public String generate(BType type) { return this.generate(type, false); }
@@ -137,7 +139,13 @@ public class TypeGenerator {
             ST template = group.getInstanceOf("set_type");
             TemplateHandler.add(template, "fromOtherMachine", false);
             if(!(subType instanceof UntypedType)) { // subType is a type other than couple type and void type
-                TemplateHandler.add(template, "type", generate(subType));
+                if (forEmbedded) {
+                    if (!setDefinitions.containsDefinition(subType)) generate(subType);
+                    SetDefinition subDefinition = setDefinitions.getDefinition(subType);
+                    TemplateHandler.add(template, "type", subDefinition.getName());
+                } else {
+                    TemplateHandler.add(template, "type", generate(subType));
+                }
             }
             return template.render();
 
@@ -173,6 +181,7 @@ public class TypeGenerator {
                 if (subDefinition == null) subDefinition = addSetDefinition(subType);
                 SetDefinition result = subDefinition.getPowSetDefinition(group.getInstanceOf("set_element_name"));
                 this.setDefinitions.addDefinition(result);
+                declarationGenerator.generateSetEnumName(type);
                 return result;
             }
         } else if (type instanceof CoupleType) {
diff --git a/src/main/resources/de/hhu/stups/codegenerator/RustTemplate_e.stg b/src/main/resources/de/hhu/stups/codegenerator/RustTemplate_e.stg
index c8e15220d577f9b1a66a7b34ae6acc0ef6f1b601..2ca09eae49c557df87a1db99b76de8cf91c56a47 100644
--- a/src/main/resources/de/hhu/stups/codegenerator/RustTemplate_e.stg
+++ b/src/main/resources/de/hhu/stups/codegenerator/RustTemplate_e.stg
@@ -1,5 +1,5 @@
 keywords() ::= <<
-as, break, const, continue, crate, else, enum, extern, false, fn, for, if, impl, in, let, loop, match, mod, move, mut, pub, ref, return, self, Self, static, struct, super, trait, true, type, unsafe, use, where, while, async, await, dyn, abstract, become, box, do, final, macro, override, priv, typeof, unsized, virtual, yield, try, union, dyn, min, max, new
+as, break, const, continue, crate, else, enum, extern, false, fn, for, if, impl, in, let, loop, match, mod, move, mut, pub, ref, return, self, Self, static, struct, super, trait, true, type, unsafe, use, where, while, async, await, dyn, abstract, become, box, do, final, macro, override, priv, typeof, unsized, virtual, yield, try, dyn, min, max, new
 >>
 
 
@@ -10,6 +10,8 @@ use btypes::{bset, brel};
 use btypes::bset::BSet;
 use btypes::bset::SetItem;
 use btypes::bset::PowSetItem;
+use btypes::bset::PowAble;
+use btypes::bset::NestedSet;
 use btypes::brelation::BRelation;
 use btypes::brelation::RelLeftItem;
 use btypes::bboolean::BBoolean;
diff --git a/src/test/java/de/hhu/stups/codegenerator/rust_embedded/TestSets.java b/src/test/java/de/hhu/stups/codegenerator/rust_embedded/TestSets.java
index 0602051d6c3bcd0a2844b884f9bf0ad4981864ee..6bf64fbfc5eb80a3b413d352b8784bc05a81055c 100644
--- a/src/test/java/de/hhu/stups/codegenerator/rust_embedded/TestSets.java
+++ b/src/test/java/de/hhu/stups/codegenerator/rust_embedded/TestSets.java
@@ -1,86 +1,123 @@
 package de.hhu.stups.codegenerator.rust_embedded;
 
-import de.hhu.stups.codegenerator.CodeGenerator;
-import de.hhu.stups.codegenerator.GeneratorMode;
-import de.hhu.stups.codegenerator.TestHelper;
-import org.junit.Before;
 import org.junit.Test;
 
-import java.io.File;
 import java.io.IOException;
 import java.net.URISyntaxException;
-import java.net.URL;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import static org.junit.Assert.assertNotNull;
-
-public class TestSets {
-    final ClassLoader classLoader = this.getClass().getClassLoader();
-    final Path rustSrcPath = Paths.get(classLoader.getResource("./").toURI()).getParent().getParent().getParent().getParent().resolve(Paths.get("btypes_primitives/src/main/rust_embedded/bmachine/src"));
-    final Runtime runtime = Runtime.getRuntime();
-
-    public TestSets() throws URISyntaxException, IOException {
-        Files.createDirectories(rustSrcPath);
-    }
-
-    @Before
-    public void beforeEach() {
-        File[] oldFiles = rustSrcPath.toFile().listFiles();
-        if (oldFiles != null) Arrays.stream(oldFiles).forEach(File::delete);
-    }
-
-    @Test
-    public void test_SimpleEnumeratedSet() throws IOException, InterruptedException {
-        boolean execute = true;
-        boolean modelChecking = false;
-        boolean noInv = false;
-        boolean noDead = false;
-
-        String machineFile = "";
-        URL machineURL = classLoader.getResource("de/hhu/stups/codegenerator/embedded/" + machineFile);
-        assertNotNull(machineURL);
-        Path machinePath = Paths.get(machineURL.getPath());
-        List<Path> rsFilePaths = TestHelper.generateCode(machinePath, GeneratorMode.RS, false, "DefaultAddition.strs", true);
-        rsFilePaths = rsFilePaths.stream().map(path -> {
-            Path dest = rustSrcPath.resolve(Paths.get(path.toFile().getName()));
-            path.toFile().renameTo(dest.toFile());
-            return dest;
-        }).collect(Collectors.toList());
-
-        Path mainPath = rsFilePaths.get(rsFilePaths.size() - 1);
-        File newMainFile = rustSrcPath.resolve(Paths.get("main.rs")).toFile();
-        mainPath.toFile().renameTo(newMainFile);
-
-        Process process = runtime.exec("cargo build --release --manifest-path " + mainPath.getParent().getParent().toFile().getAbsolutePath() + "/Cargo.toml");
-        TestHelper.writeInputToSystem(process.getErrorStream());
-        TestHelper.writeInputToOutput(process.getErrorStream(), process.getOutputStream());
-        process.waitFor();
-        if (process.exitValue() != 0) {
-            throw new RuntimeException("cargo build failed, exitcode: " + process.exitValue());
-        }
-
-        if(!execute) {
-            rsFilePaths.forEach(p -> p.toFile().delete());
-            return;
-        }
-
-        String progArgs = "";
-        if (modelChecking) { progArgs = " -- mixed 2 true"; }
-        if (noDead) { progArgs += " -nodead"; }
-        if (noInv) { progArgs += " -noinv"; }
-
-        Process executeProcess = runtime.exec("cargo run --release --manifest-path " + mainPath.getParent().getParent().toFile().getAbsolutePath() + "/Cargo.toml" + progArgs);
-        executeProcess.waitFor();
-
-        String error = TestHelper.streamToString(executeProcess.getErrorStream());
-        if(executeProcess.exitValue() != 0) {
-            throw new RuntimeException(error);
-        }
-        String result = TestHelper.streamToString(executeProcess.getInputStream());
+
+public class TestSets extends TestRSE {
+    public TestSets() throws URISyntaxException, IOException {}
+
+    @Test
+    public void testEmptySet() throws Exception {
+        testRSE("EmptySet", "EmptySetAddition.strs");
+    }
+
+    @Test
+    public void testPow() throws Exception {
+        testRSE("Pow", "PowAddition.strs");
+    }
+
+    @Test
+    public void testPow1() throws Exception {
+        testRSE("Pow1", "Pow1Addition.strs");
+    }
+
+    @Test
+    public void testFin() throws Exception {
+        testRSE("Fin", "FinAddition.strs");
+    }
+
+    @Test
+    public void testFin1() throws Exception {
+        testRSE("Fin1", "Fin1Addition.strs");
+    }
+
+    @Test
+    public void testCard() throws Exception {
+        testRSE("Card", "CardAddition.strs");
+    }
+
+    @Test
+    public void testUnion() throws Exception {
+        testRSE("Union", "UnionAddition.strs");
+    }
+
+    @Test
+    public void testIntersection() throws Exception {
+        testRSE("Intersection", "IntersectionAddition.strs");
+    }
+
+    @Test
+    public void testDifference() throws Exception {
+        testRSE("Difference", "DifferenceAddition.strs");
+    }
+
+    @Test
+    public void testElementOf() throws Exception {
+        testRSE("ElementOf", "ElementOfAddition.strs");
+    }
+
+    @Test
+    public void testNotElementOf() throws Exception {
+        testRSE("NotElementOf", "NotElementOfAddition.strs");
+    }
+
+    @Test
+    public void testSubset() throws Exception {
+        testRSE("Subset", "SubsetAddition.strs");
+    }
+
+    @Test
+    public void testNotSubset() throws Exception {
+        testRSE("NotSubset", "NotSubsetAddition.strs");
+    }
+
+    @Test
+    public void testStrictSubset() throws Exception {
+        testRSE("StrictSubset", "StrictSubsetAddition.strs");
+    }
+
+    @Test
+    public void testNotStrictSubset() throws Exception {
+        testRSE("NotStrictSubset", "NotStrictSubsetAddition.strs");
+    }
+
+    @Test
+    public void testGeneralizedUnion() throws Exception {
+        testRSE("GeneralizedUnion", "GeneralizedUnionAddition.strs");
+    }
+
+    @Test
+    public void testGeneralizedUnionEmpty() throws Exception {
+        testRSE("GeneralizedUnionEmpty", "GeneralizedUnionEmptyAddition.strs");
+    }
+
+    @Test
+    public void testGeneralizedIntersection() throws Exception {
+        testRSE("GeneralizedIntersection", "GeneralizedIntersectionAddition.strs");
+    }
+
+    @Test
+    public void testGeneralizedIntersectionEmpty() throws Exception {
+        testRSE("GeneralizedIntersectionEmpty", "GeneralizedIntersectionEmptyAddition.strs");
+    }
+
+
+
+// These tests won't work, because they require Integer-Sets, which embedded code-gen cannot do (for now)
+    @Test(expected = RuntimeException.class)
+    public void testInterval() throws Exception {
+        testRSE("Interval", "IntervalAddition.strs");
+    }
+
+    @Test(expected = RuntimeException.class)
+    public void testMax() throws Exception {
+        testRSE("Max", "MaxAddition.strs");
+    }
+
+    @Test(expected = RuntimeException.class)
+    public void testMin() throws Exception {
+        testRSE("Min", "MinAddition.strs");
     }
 }
diff --git a/src/test/resources/de/hhu/stups/codegenerator/Card.mch b/src/test/resources/de/hhu/stups/codegenerator/Card.mch
index 9307852368bd8f35b1f1377d33ee7439861f85fd..3a1cd5e9f17779598b9498c4e36c4de6b071d4ab 100644
--- a/src/test/resources/de/hhu/stups/codegenerator/Card.mch
+++ b/src/test/resources/de/hhu/stups/codegenerator/Card.mch
@@ -1,14 +1,16 @@
 MACHINE Card
 
-VARIABLES  x, r
+SETS X = {ONE, TWO}
 
-INVARIANT  x : POW(INT) & r : INT
+VARIABLES  r
 
-INITIALISATION x := {1,2}; r := 0
+INVARIANT  r : INT
+
+INITIALISATION r := 0
 
 OPERATIONS
 
-	calculate = BEGIN r := card(x) END;
+	calculate = BEGIN r := card(X) END;
 	out <-- getRes = out := r
 
 END
\ No newline at end of file
diff --git a/src/test/resources/de/hhu/stups/codegenerator/Difference.mch b/src/test/resources/de/hhu/stups/codegenerator/Difference.mch
index 14b5abd55c2af666d9cf2f1d7683e0b00db647d9..c970dd298b5213fcd016d53a294308b058b4c260 100644
--- a/src/test/resources/de/hhu/stups/codegenerator/Difference.mch
+++ b/src/test/resources/de/hhu/stups/codegenerator/Difference.mch
@@ -1,10 +1,12 @@
 MACHINE Difference
 
+SETS EINT = {ONE, TWO, THREE, FOUR}
+
 VARIABLES  x, y, z
 
-INVARIANT  x : POW(INT) & y : POW(INT) & z : POW(INT)
+INVARIANT  x <: EINT & y <: EINT & z <: EINT
 
-INITIALISATION x := {1,2}; y := {2,3}; z := {}
+INITIALISATION x := {ONE, TWO}; y := {TWO, THREE}; z := {}
 
 OPERATIONS
 
diff --git a/src/test/resources/de/hhu/stups/codegenerator/ElementOf.mch b/src/test/resources/de/hhu/stups/codegenerator/ElementOf.mch
index b23bd6fd5f917b869095125848c7773d95317e99..0155050a569ca13fda36b987b0ec0cd57e931a66 100644
--- a/src/test/resources/de/hhu/stups/codegenerator/ElementOf.mch
+++ b/src/test/resources/de/hhu/stups/codegenerator/ElementOf.mch
@@ -1,10 +1,12 @@
 MACHINE ElementOf
 
+SETS EINT = {ONE, TWO, THREE}
+
 VARIABLES  x, y, r
 
-INVARIANT  x : POW(INT) & y : INT & r : BOOL
+INVARIANT  x <: EINT & y : EINT & r : BOOL
 
-INITIALISATION x := {1,2}; y:= 1; r := TRUE
+INITIALISATION x := {ONE, TWO}; y:= ONE; r := TRUE
 
 OPERATIONS
 
diff --git a/src/test/resources/de/hhu/stups/codegenerator/EmptySet.mch b/src/test/resources/de/hhu/stups/codegenerator/EmptySet.mch
index 4bae87f79ed8566ab6264a9b09c9a454ac74418d..7a0fbec3236c9f1d56ba1ef5fb0df4e9de3f9685 100644
--- a/src/test/resources/de/hhu/stups/codegenerator/EmptySet.mch
+++ b/src/test/resources/de/hhu/stups/codegenerator/EmptySet.mch
@@ -1,8 +1,10 @@
 MACHINE EmptySet
 
+SETS S={S1}
+
 VARIABLES  f
 
-INVARIANT  f : POW(INT)
+INVARIANT  f : POW(S)
 
 INITIALISATION f := {}
 
diff --git a/src/test/resources/de/hhu/stups/codegenerator/EmptySetAddition.strs b/src/test/resources/de/hhu/stups/codegenerator/EmptySetAddition.strs
index de6494f1f3697d75a16231d394bef8717154487c..df080425b2903ffe64d9acbf84f876981e6304ba 100644
--- a/src/test/resources/de/hhu/stups/codegenerator/EmptySetAddition.strs
+++ b/src/test/resources/de/hhu/stups/codegenerator/EmptySetAddition.strs
@@ -1,5 +1,6 @@
 fn main() {
     let mut empty = EmptySet::new();
     empty.calculate();
-    println!("{}", empty.getRes());
+    if empty.getRes().card() == 0 { println!("{{}}"); }
+    else { println!("Wrong output!") }
 }
\ No newline at end of file
diff --git a/src/test/resources/de/hhu/stups/codegenerator/Fin.mch b/src/test/resources/de/hhu/stups/codegenerator/Fin.mch
index d455e58930475fbbba12223ba3db9175c1a9a687..1cebc4d9c9bd6db4b92f250729644531d3a3c23f 100644
--- a/src/test/resources/de/hhu/stups/codegenerator/Fin.mch
+++ b/src/test/resources/de/hhu/stups/codegenerator/Fin.mch
@@ -1,14 +1,16 @@
 MACHINE Fin
 
-VARIABLES  f, r
+SETS F = {ONE, TWO, THREE}
 
-INVARIANT  f : POW(INT) & r : POW(POW(INT))
+VARIABLES  r
 
-INITIALISATION f := {1,2,3}; r := {}
+INVARIANT  r <: POW(F)
+
+INITIALISATION r := {}
 
 OPERATIONS
 
-	calculate = BEGIN r := FIN(f) END;
+	calculate = BEGIN r := FIN(F) END;
 	out <-- getRes = out := card(r)
 
 END
\ No newline at end of file
diff --git a/src/test/resources/de/hhu/stups/codegenerator/Fin1.mch b/src/test/resources/de/hhu/stups/codegenerator/Fin1.mch
index 53dfbeff8db95a79ed7b94bee152a42af619b195..1535526539076f081f84c3a41458845a1abb4190 100644
--- a/src/test/resources/de/hhu/stups/codegenerator/Fin1.mch
+++ b/src/test/resources/de/hhu/stups/codegenerator/Fin1.mch
@@ -1,14 +1,16 @@
 MACHINE Fin1
 
-VARIABLES  f, r
+SETS F = {ONE, TWO, THREE}
 
-INVARIANT  f : POW(INT) & r : POW(POW(INT))
+VARIABLES  r
 
-INITIALISATION f := {1,2,3}; r := {}
+INVARIANT  r <: POW(F)
+
+INITIALISATION r := {}
 
 OPERATIONS
 
-	calculate = BEGIN r := FIN1(f) END;
+	calculate = BEGIN r := FIN1(F) END;
 	out <-- getRes = out := card(r)
 
 END
\ No newline at end of file
diff --git a/src/test/resources/de/hhu/stups/codegenerator/GeneralizedIntersection.mch b/src/test/resources/de/hhu/stups/codegenerator/GeneralizedIntersection.mch
index f32d035abd5a131bbca3f6ea2019ba60a98ff81c..237c4a70bf3b437f9764415ba9ebbc4742474320 100644
--- a/src/test/resources/de/hhu/stups/codegenerator/GeneralizedIntersection.mch
+++ b/src/test/resources/de/hhu/stups/codegenerator/GeneralizedIntersection.mch
@@ -1,10 +1,12 @@
 MACHINE GeneralizedIntersection
 
+SETS EINT = {ONE, TWO, THREE, FOUR}
+
 VARIABLES  set, x
 
-INVARIANT  set : POW(POW(INTEGER)) & x : POW(INTEGER)
+INVARIANT  set : POW(POW(EINT)) & x : POW(EINT)
 
-INITIALISATION set := {{1},{2},{3}}; x := {}
+INITIALISATION set := {{ONE},{TWO},{THREE}}; x := {}
 
 OPERATIONS
 
diff --git a/src/test/resources/de/hhu/stups/codegenerator/GeneralizedIntersectionEmpty.mch b/src/test/resources/de/hhu/stups/codegenerator/GeneralizedIntersectionEmpty.mch
index 1798ff0457d3a652491d2532cb7795a2a57db6ef..9cad6cfd1682e5aa80bfccbde4f9270f2f1cf4d8 100644
--- a/src/test/resources/de/hhu/stups/codegenerator/GeneralizedIntersectionEmpty.mch
+++ b/src/test/resources/de/hhu/stups/codegenerator/GeneralizedIntersectionEmpty.mch
@@ -1,14 +1,16 @@
 MACHINE GeneralizedIntersectionEmpty
 
+SETS EINT = {ONE, TWO, THREE, FOUR}
+
 VARIABLES  set, x
 
-INVARIANT  set : POW(POW(INTEGER)) & x : POW(INTEGER)
+INVARIANT  set : POW(POW(EINT)) & x : POW(EINT)
 
 INITIALISATION set := {}; x := {}
 
 OPERATIONS
 
-	calculate = BEGIN x := inter(set); x := x \/ {1} END;
+	calculate = BEGIN x := inter(set); x := x \/ {ONE} END;
 	out <-- getSet = out := set
 
 END
\ No newline at end of file
diff --git a/src/test/resources/de/hhu/stups/codegenerator/GeneralizedUnion.mch b/src/test/resources/de/hhu/stups/codegenerator/GeneralizedUnion.mch
index 657347e22c429609cb2f003d1b13f2715efbe711..821c9651e42fabb0a276ee7a7526446e362c54b3 100644
--- a/src/test/resources/de/hhu/stups/codegenerator/GeneralizedUnion.mch
+++ b/src/test/resources/de/hhu/stups/codegenerator/GeneralizedUnion.mch
@@ -1,10 +1,12 @@
 MACHINE GeneralizedUnion
 
+SETS EINT = {ONE, TWO, THREE, FOUR}
+
 VARIABLES  set, x
 
-INVARIANT  set : POW(POW(INTEGER)) & x : POW(INTEGER)
+INVARIANT  set : POW(POW(EINT)) & x : POW(EINT)
 
-INITIALISATION set := {{1},{2},{3}}; x := {}
+INITIALISATION set := {{ONE},{TWO},{THREE}}; x := {}
 
 OPERATIONS
 
diff --git a/src/test/resources/de/hhu/stups/codegenerator/GeneralizedUnionEmpty.mch b/src/test/resources/de/hhu/stups/codegenerator/GeneralizedUnionEmpty.mch
index a036bd2d8ff9341be3d56ecba8472f19bc98f169..74cdb66f6fed82c432bc5a3831d30131fc582af6 100644
--- a/src/test/resources/de/hhu/stups/codegenerator/GeneralizedUnionEmpty.mch
+++ b/src/test/resources/de/hhu/stups/codegenerator/GeneralizedUnionEmpty.mch
@@ -1,14 +1,16 @@
 MACHINE GeneralizedUnionEmpty
 
+SETS EINT = {ONE, TWO, THREE, FOUR}
+
 VARIABLES  set, x
 
-INVARIANT  set : POW(POW(INTEGER)) & x : POW(INTEGER)
+INVARIANT  set : POW(POW(EINT)) & x : POW(EINT)
 
 INITIALISATION set := {}; x := {}
 
 OPERATIONS
 
-	calculate = BEGIN x := union(set); x := x \/ {1} END;
+	calculate = BEGIN x := union(set); x := x \/ {ONE} END;
 	out <-- getSet = out := set
 
 END
\ No newline at end of file
diff --git a/src/test/resources/de/hhu/stups/codegenerator/Intersection.mch b/src/test/resources/de/hhu/stups/codegenerator/Intersection.mch
index 85ee54aba28f7ce33acac7bf058e35842c17e0b3..b3abf76b6b784a6d4229cb5aad040bccdd67661b 100644
--- a/src/test/resources/de/hhu/stups/codegenerator/Intersection.mch
+++ b/src/test/resources/de/hhu/stups/codegenerator/Intersection.mch
@@ -1,10 +1,12 @@
 MACHINE Intersection
 
+SETS EINT = {ONE, TWO, THREE, FOUR}
+
 VARIABLES  x, y, z
 
-INVARIANT  x : POW(INT) & y : POW(INT) & z : POW(INT)
+INVARIANT  x <: EINT & y <: EINT & z <: EINT
 
-INITIALISATION x := {1,2}; y := {2,3}; z := {}
+INITIALISATION x := {ONE, TWO}; y := {TWO, THREE}; z := {}
 
 OPERATIONS
 
diff --git a/src/test/resources/de/hhu/stups/codegenerator/IntersectionAddition.strs b/src/test/resources/de/hhu/stups/codegenerator/IntersectionAddition.strs
index c9941e2923005d43a4e332b277ff5bc1419865b2..4fa58faa9194a0cfbb9adbb6bb2b539aa431a645 100644
--- a/src/test/resources/de/hhu/stups/codegenerator/IntersectionAddition.strs
+++ b/src/test/resources/de/hhu/stups/codegenerator/IntersectionAddition.strs
@@ -1,5 +1,10 @@
 fn main() {
     let mut intersection = Intersection::new();
     intersection.calculate();
-    println!("{}", intersection.getRes());
+    let res = intersection.getRes();
+    if res.card() == 1 && res.elementOf(&EINT::TWO) {
+        println!("{{2}}");
+    } else {
+        println!("Wrong output! Card is: {}", res.card())
+    }
 }
\ No newline at end of file
diff --git a/src/test/resources/de/hhu/stups/codegenerator/NotElementOf.mch b/src/test/resources/de/hhu/stups/codegenerator/NotElementOf.mch
index 7a3e3190f54511b5f33cc3e4ed3687a8072031c1..4168eb88ecb5ecdb14701697ec3b947df07b0ff0 100644
--- a/src/test/resources/de/hhu/stups/codegenerator/NotElementOf.mch
+++ b/src/test/resources/de/hhu/stups/codegenerator/NotElementOf.mch
@@ -1,10 +1,12 @@
 MACHINE NotElementOf
 
+SETS EINT = {ONE, TWO, THREE}
+
 VARIABLES  x, y, r
 
-INVARIANT  x : POW(INT) & y : INT & r : BOOL
+INVARIANT  x <: EINT & y : EINT & r : BOOL
 
-INITIALISATION x := {1,2}; y:= 1; r := FALSE
+INITIALISATION x := {ONE, TWO}; y:= ONE; r := FALSE
 
 OPERATIONS
 
diff --git a/src/test/resources/de/hhu/stups/codegenerator/NotStrictSubset.mch b/src/test/resources/de/hhu/stups/codegenerator/NotStrictSubset.mch
index 4d3ad4c8f6a67377a3cd1a0e07f1d8d93162c81e..a0963d4fb060e7728e6c9cef08f0825e2c5b8b09 100644
--- a/src/test/resources/de/hhu/stups/codegenerator/NotStrictSubset.mch
+++ b/src/test/resources/de/hhu/stups/codegenerator/NotStrictSubset.mch
@@ -1,10 +1,12 @@
 MACHINE NotStrictSubset
 
+SETS EINT = {ONE, TWO, THREE, FOUR}
+
 VARIABLES  x, y, r
 
-INVARIANT  x : POW(INT) & y : POW(INT) & r : BOOL
+INVARIANT  x <: EINT & y <: EINT & r : BOOL
 
-INITIALISATION x := {1,2}; y:= {1,2,3}; r := FALSE
+INITIALISATION x := {ONE, TWO}; y:= {ONE, TWO, THREE}; r := FALSE
 
 OPERATIONS
 
diff --git a/src/test/resources/de/hhu/stups/codegenerator/NotSubset.mch b/src/test/resources/de/hhu/stups/codegenerator/NotSubset.mch
index 6b505fd1ba0aeb56a3b91c1abb4dcc4b28bba078..6c828b8d6e910f5d3e883e3420505579046b252f 100644
--- a/src/test/resources/de/hhu/stups/codegenerator/NotSubset.mch
+++ b/src/test/resources/de/hhu/stups/codegenerator/NotSubset.mch
@@ -1,10 +1,12 @@
 MACHINE NotSubset
 
+SETS EINT = {ONE, TWO, THREE, FOUR}
+
 VARIABLES  x, y, r
 
-INVARIANT  x : POW(INT) & y : POW(INT) & r : BOOL
+INVARIANT  x <: EINT & y <: EINT & r : BOOL
 
-INITIALISATION x := {1,2}; y:= {1,2,3}; r := FALSE
+INITIALISATION x := {ONE, TWO}; y:= {ONE, TWO, THREE}; r := FALSE
 
 OPERATIONS
 
diff --git a/src/test/resources/de/hhu/stups/codegenerator/Pow.mch b/src/test/resources/de/hhu/stups/codegenerator/Pow.mch
index 2f40c155738e67225b2702ea75741fd648f2e785..9af50ba037c7ebc8f40cfd218f0704aa367f4fe1 100644
--- a/src/test/resources/de/hhu/stups/codegenerator/Pow.mch
+++ b/src/test/resources/de/hhu/stups/codegenerator/Pow.mch
@@ -1,14 +1,16 @@
 MACHINE Pow
 
-VARIABLES  f, r
+SETS F = {ONE, TWO, THREE}
 
-INVARIANT  f : POW(INT) & r : POW(POW(INT))
+VARIABLES  r
 
-INITIALISATION f := {1,2,3}; r := {}
+INVARIANT  r <: POW(F)
+
+INITIALISATION r := {}
 
 OPERATIONS
 
-	calculate = BEGIN r := POW(f) END;
+	calculate = BEGIN r := POW(F) END;
 	out <-- getRes = out := card(r)
 
 END
\ No newline at end of file
diff --git a/src/test/resources/de/hhu/stups/codegenerator/Pow1.mch b/src/test/resources/de/hhu/stups/codegenerator/Pow1.mch
index 99e344337112b7bb41e2aacfe2e244d8dff545fa..89e5011c7f882ded9661828ec48bc636cafa917e 100644
--- a/src/test/resources/de/hhu/stups/codegenerator/Pow1.mch
+++ b/src/test/resources/de/hhu/stups/codegenerator/Pow1.mch
@@ -1,14 +1,16 @@
 MACHINE Pow1
 
-VARIABLES  f, r
+SETS F = {ONE, TWO, THREE}
 
-INVARIANT  f : POW(INT) & r : POW(POW(INT))
+VARIABLES  r
 
-INITIALISATION f := {1,2,3}; r := {}
+INVARIANT  r <: POW(F)
+
+INITIALISATION r := {}
 
 OPERATIONS
 
-	calculate = BEGIN r := POW1(f) END;
+	calculate = BEGIN r := POW1(F) END;
 	out <-- getRes = out := card(r)
 
 END
\ No newline at end of file
diff --git a/src/test/resources/de/hhu/stups/codegenerator/StrictSubset.mch b/src/test/resources/de/hhu/stups/codegenerator/StrictSubset.mch
index 78e00c87ff0b34e4c16abd99ee2fdce64c889fd0..157bb9c57bf907073b4d9d5396c0c66679c198a5 100644
--- a/src/test/resources/de/hhu/stups/codegenerator/StrictSubset.mch
+++ b/src/test/resources/de/hhu/stups/codegenerator/StrictSubset.mch
@@ -1,10 +1,12 @@
 MACHINE StrictSubset
 
+SETS EINT = {ONE, TWO, THREE, FOUR}
+
 VARIABLES  x, y, r
 
-INVARIANT  x : POW(INT) & y : POW(INT) & r : BOOL
+INVARIANT  x <: EINT & y <: EINT & r : BOOL
 
-INITIALISATION x := {1,2}; y:= {1,2,3}; r := TRUE
+INITIALISATION x := {ONE, TWO}; y:= {ONE, TWO, THREE}; r := TRUE
 
 OPERATIONS
 
diff --git a/src/test/resources/de/hhu/stups/codegenerator/Subset.mch b/src/test/resources/de/hhu/stups/codegenerator/Subset.mch
index 2177707e163caa532194760f8ec1f96c2b1f0faa..02231662421918043a318f7389d29117c1fbe4fe 100644
--- a/src/test/resources/de/hhu/stups/codegenerator/Subset.mch
+++ b/src/test/resources/de/hhu/stups/codegenerator/Subset.mch
@@ -1,10 +1,12 @@
 MACHINE Subset
 
+SETS EINT = {ONE, TWO, THREE, FOUR}
+
 VARIABLES  x, y, r
 
-INVARIANT  x : POW(INT) & y : POW(INT) & r : BOOL
+INVARIANT  x <: EINT & y <: EINT & r : BOOL
 
-INITIALISATION x := {1,2}; y:= {1,2,3}; r := TRUE
+INITIALISATION x := {ONE, TWO}; y:= {ONE, TWO, THREE}; r := TRUE
 
 OPERATIONS
 
diff --git a/src/test/resources/de/hhu/stups/codegenerator/Union.mch b/src/test/resources/de/hhu/stups/codegenerator/Union.mch
index c5169a0ce9f300f8a829902d684cc686d9afa41c..cde5006ed9fb9ed8be60abda996150d44de74e3a 100644
--- a/src/test/resources/de/hhu/stups/codegenerator/Union.mch
+++ b/src/test/resources/de/hhu/stups/codegenerator/Union.mch
@@ -1,10 +1,12 @@
 MACHINE Union
 
+SETS EINT = {ONE, TWO, THREE, FOUR}
+
 VARIABLES  x, y, z
 
-INVARIANT  x : POW(INT) & y : POW(INT) & z : POW(INT)
+INVARIANT  x <: EINT & y <: EINT & z <: EINT
 
-INITIALISATION x := {1,2}; y := {2,3}; z := {}
+INITIALISATION x := {ONE, TWO}; y := {TWO, THREE}; z := {}
 
 OPERATIONS