diff --git a/CompilerGeneration.jrag b/CompilerGeneration.jrag
index 877c192f2a158f7d0e6d0b19bd75e55465b585dd..3f51003f9bebf044a9f89cfc57a12388b6e8f1cd 100644
--- a/CompilerGeneration.jrag
+++ b/CompilerGeneration.jrag
@@ -111,18 +111,18 @@ aspect GenAspects {
 		pStream.println("import java.io.PrintStream;");
 		pStream.println();
 		genRewrites(pStream);
-		genPrettyPrinter(" ",pStream);
+		genPrettyPrinter(pStream);
 	}
 }
 
 aspect GenPrettyPrinter {
-	public void ASTNode.genPrettyPrinter(String ind, PrintStream pStream) {
+	public void ASTNode.genPrettyPrinter(PrintStream pStream) {
 		for (int i=0; i<getNumChild(); i++) {
-			getChild(i).genPrettyPrinter(ind, pStream);
+			getChild(i).genPrettyPrinter(pStream);
 		}
 	}
 
-	public void Start.genPrettyPrinter(String ind, PrintStream pStream) {
+	public void Start.genPrettyPrinter(PrintStream pStream) {
 		pStream.println();
 		pStream.println("aspect PrettyPrinter {");
 		pStream.println("  public void ASTNode.prettyPrint(String indent, PrintStream pStream) {");
@@ -135,28 +135,36 @@ aspect GenPrettyPrinter {
 		pStream.println("      getElement(i).prettyPrint(indent,pStream);");
 		pStream.println("    }");
 		pStream.println("  }\n");
-		super.genPrettyPrinter(ind,pStream);
+		super.genPrettyPrinter(pStream);
 		pStream.println("}\n");
 	}
 
-	public void OwlClassDecl.genPrettyPrinter(String ind, PrintStream pStream) {
-		pStream.print("  public void "+name());
+	public void OwlClassDecl.genPrettyPrinter(PrintStream pStream) {
+		pStream.print(ind(1)+"public void "+name());
 		pStream.println(".prettyPrint(String indent, PrintStream pStream) {");
-		pStream.print("    System.out.println(indent+\"<"+name());
-// 		for (int i=0; i<getNumAttribute(); i++) {
-// 			getAttribute(i).genPrettyPrinter(ind,pStream);
-// 		}
-		pStream.println(">\");");
-		pStream.println("    String childIndent = indent + \"  \";");
+		pStream.println(ind(2)+"System.out.print(indent+\"<"+name()+"\");");
+		pStream.println(ind(2)+"for (int i=0; i<getNumAttribute(); i++) {");
+		pStream.println(ind(3)+"getAttribute(i).prettyPrint(indent,pStream);");
+		pStream.println(ind(2)+"}");
+		pStream.println("System.out.println(\">\");");
+		pStream.println(ind(2)+"String childIndent = indent + \"  \";");
 		Restrictions restr = getRestrictions();
 		for (int i=0; i<restr.getNumOwlRestriction(); i++) {
-
+			OwlRestriction r = restr.getOwlRestriction(i);
+			pStream.println(ind(2)+"System.out.println(childIndent+\"<has"+
+							r.name()+">\");");
+			pStream.println(ind(2)+"for (int i=0; i<getNum"+r.name()+"(); i++) {");
+			pStream.println(ind(3)+"get"+r.name()+
+							"(i).prettyPrint(childIndent+\"  \",pStream);");
+			pStream.println(ind(2)+"}");
+			pStream.println(ind(2)+"System.out.println(childIndent+\"</has"+
+							r.name()+">\");");
 		}
-		pStream.println("    for (int i=0; i<getNumElement(); i++) {");
-		pStream.println("      getElement(i).prettyPrint(childIndent,pStream);");
-		pStream.println("    }");
-		pStream.println("    System.out.println(indent+\"</"+name()+">\");");
-		pStream.println("}\n");		
+// 		pStream.println(ind(1)+"    for (int i=0; i<getNumElement(); i++) {");
+// 		pStream.println(ind(1)+"      getElement(i).prettyPrint(childIndent,pStream);");
+// 		pStream.println(ind(1)+"    }");
+		pStream.println(ind(1)+"System.out.println(indent+\"</"+name()+">\");");
+		pStream.println(ind(1)+"}\n");		
 	}
 }
 
@@ -193,8 +201,9 @@ aspect GenRewrites {
 			OwlRestriction r = restr.getOwlRestriction(i);
 			pStream.println(ind(3)+"l = new List();");
 			pStream.println(ind(3)+"for (int i=0; i<getNumElement(); i++) {");
-			pStream.println(ind(4)+"if (getElement(i) instanceof "+r.name()+") {");
-			pStream.println(ind(5)+"l.add(getElement(i));");
+			pStream.println(ind(3)+"ComplexElement e = (ComplexElement) getElement(i);");
+			pStream.println(ind(4)+"if (e.getNumElement() > 0 && e.getElement(0) instanceof "+r.name()+") {");
+			pStream.println(ind(5)+"l.add(e.getElement(0));");
 			pStream.println(ind(4)+"}");
 			pStream.println(ind(3)+"}");
 			if (r.allValuesFrom()) {
diff --git a/testontologies/small_v08.owl b/testontologies/small_v08.owl
new file mode 100644
index 0000000000000000000000000000000000000000..7daeae4d987f2c829917e9b2cd9aa7d4d08f4c9d
--- /dev/null
+++ b/testontologies/small_v08.owl
@@ -0,0 +1,91 @@
+  <VacuumGripper rdf:ID="Schmalz_FSGPL_200_NBR-55_G1-2-IG">
+    <hasProperty>
+      <DiameterOfGripper rdf:ID="DiameterOfGripper_200">
+        <isPropertyOf rdf:resource="#Schmalz_FSGPL_200_NBR-55_G1-2-IG"/>
+        <value rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
+        >200.0</value>
+      </DiameterOfGripper>
+    </hasProperty>
+    <hasProperty>
+      <Worm rdf:ID="Worm_Inside">
+        <isPropertyOf rdf:resource="#Schmalz_FSGPL_200_NBR-55_G1-2-IG"/>
+        <value rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
+        >Inside</value>
+      </Worm>
+    </hasProperty>
+    <hasSkill>
+      <AdjustVacuumToGrip rdf:ID="AdjustVacuumToGrip_16">
+        <isSkillOf rdf:resource="#Schmalz_FSGPL_200_NBR-55_G1-2-IG"/>
+        <isSkillOf>
+          <VacuumGripper rdf:ID="Schmalz_FSGA_20_SI-55_M5-AG">
+            <hasSkill rdf:resource="#AdjustVacuumToGrip_16"/>
+            <hasProperty>
+              <WormDiameter rdf:ID="WormDiameter_M5">
+                <value rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
+                >M5</value>
+                <isPropertyOf rdf:resource="#Schmalz_FSGA_20_SI-55_M5-AG"/>
+              </WormDiameter>
+            </hasProperty>
+            <hasProperty>
+              <Worm rdf:ID="Worm_Outside">
+                <isPropertyOf rdf:resource="#Schmalz_FSGA_20_SI-55_M5-AG"/>
+                <value rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
+                >Outside</value>
+              </Worm>
+            </hasProperty>
+            <hasProperty>
+              <DiameterOfGripper rdf:ID="DiameterOfGripper_20">
+                <isPropertyOf rdf:resource="#Schmalz_FSGA_20_SI-55_M5-AG"/>
+                <value rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
+                >20.0</value>
+              </DiameterOfGripper>
+            </hasProperty>
+            <hasProperty>
+              <Material rdf:ID="Material_Silikon">
+                <isPropertyOf rdf:resource="#Schmalz_FSGA_20_SI-55_M5-AG"/>
+                <value rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
+                >Silikon SI 55+-5</value>
+              </Material>
+            </hasProperty>
+            <hasSkill>
+              <AdjustVacuumToRelease rdf:ID="AdjustVacuumToRelease_1">
+                <isSkillOf rdf:resource="#Schmalz_FSGA_20_SI-55_M5-AG"/>
+                <isSkillOf rdf:resource="#Schmalz_FSGPL_200_NBR-55_G1-2-IG"/>
+              </AdjustVacuumToRelease>
+            </hasSkill>
+            <hasProperty>
+              <MaxForce rdf:ID="MaximumForce_4.7">
+                <isPropertyOf rdf:resource="#Schmalz_FSGA_20_SI-55_M5-AG"/>
+                <value rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
+                >4.7</value>
+              </MaxForce>
+            </hasProperty>
+          </VacuumGripper>
+        </isSkillOf>
+      </AdjustVacuumToGrip>
+    </hasSkill>
+    <hasProperty>
+      <Material rdf:ID="Material_Perbunan">
+        <isPropertyOf rdf:resource="#Schmalz_FSGPL_200_NBR-55_G1-2-IG"/>
+        <value rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
+        >Perbunan NBR 55+-5</value>
+      </Material>
+    </hasProperty>
+    <hasProperty>
+      <MaxForce rdf:ID="MaximumForce_850">
+        <value rdf:datatype="http://www.w3.org/2001/XMLSchema#float"
+        >850.0</value>
+        <isPropertyOf rdf:resource="#Schmalz_FSGPL_200_NBR-55_G1-2-IG"/>
+      </MaxForce>
+    </hasProperty>
+    <hasProperty>
+      <WormDiameter rdf:ID="WormDiameter_G1-2">
+        <isPropertyOf rdf:resource="#Schmalz_FSGPL_200_NBR-55_G1-2-IG"/>
+        <value rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
+        >G1/2</value>
+      </WormDiameter>
+    </hasProperty>
+    <hasSkill rdf:resource="#AdjustVacuumToRelease_1"/>
+  </VacuumGripper>
+
+<!-- Created with Protege (with OWL Plugin 2.2, Build 311)  http://protege.stanford.edu -->