diff --git a/scope4j/src/main/jastadd/ProgramToScopeTree.jrag b/scope4j/src/main/jastadd/ProgramToScopeTree.jrag
index 497d5573defce694727b09f90e59cba06895d145..6a155b9845b353fa9faf03d6824af5aff96c685c 100644
--- a/scope4j/src/main/jastadd/ProgramToScopeTree.jrag
+++ b/scope4j/src/main/jastadd/ProgramToScopeTree.jrag
@@ -68,9 +68,13 @@ aspect ProgramToScopeTree {
 
 aspect ScopeGenerationAttributes {
 
-  // TODO this is only correct for declarations, not for all AST nodes!
   /** determine the scope an AST element is contained in or belongs to.*/
-  inh lazy ASTNode ASTNode.containingScope();
+  inh lazy ASTNode TypeDecl.containingScope();
+  inh lazy ASTNode Block.containingScope();
+  inh lazy ASTNode ForStmt.containingScope();
+  inh lazy ASTNode EnhancedForStmt.containingScope();
+  inh lazy ASTNode Declarator.containingScope();
+  inh lazy ASTNode ParameterDeclaration.containingScope();
   // contained in scope:
   eq Program.getChild().containingScope() = this;
   eq TypeDecl.getChild().containingScope() = this;
diff --git a/testprograms/simpleScope/A.java b/testprograms/simpleScope/A.java
index d16692427bf3cd8423166c9ec809fd9bd0887c27..bed8e30f007b4312eba39e3f9b445ef52d59fb72 100644
--- a/testprograms/simpleScope/A.java
+++ b/testprograms/simpleScope/A.java
@@ -12,6 +12,7 @@ public abstract class ClassA {
   public void methodNameA(int parameterA) {
     int localVarA = 1;
     int localVarB = 1;
+    int localVarC = 1;
 
     {
       int localVarInBlockA = 2;
@@ -22,7 +23,7 @@ public abstract class ClassA {
 
     class Local {
       {
-        for (int localVarA = 0; localVarA < 10; localVarA++) System.out.println(localVarA);
+        for (int localVarC = 0; localVarC < 10; localVarC++) System.out.println(localVarC);
       }
     }