diff --git a/atrim/src/atrim.cpp b/atrim/src/atrim.cpp
index ec39783844eee6397406fae4fb3332a0d5673dd4..9f79a4d6cfbba204ee0fd3a524920804ae5bc0fa 100644
--- a/atrim/src/atrim.cpp
+++ b/atrim/src/atrim.cpp
@@ -36,7 +36,7 @@ void help( void )
 
 int main(int argc, char* argv[])
 {
-    bool del_dead_only = true, del_unreachable_only = true;
+    bool del_dead_only = false, del_unreachable_only = false;
 
     static struct option long_options[] = {
       {"help",        no_argument, NULL,    'h'},
diff --git a/atrim/src/grammar/ContextFreeGrammarTransformations.cpp b/atrim/src/grammar/ContextFreeGrammarTransformations.cpp
index 553fabefc05ac73a58930a41080ba402fb3007a1..aa4af83dedca5e65af232ea61bec9ccf0ebc1560 100644
--- a/atrim/src/grammar/ContextFreeGrammarTransformations.cpp
+++ b/atrim/src/grammar/ContextFreeGrammarTransformations.cpp
@@ -23,20 +23,12 @@ set<Symbol> ContextFreeGrammarTransformations::getProductiveNonTerminals( const
     while( true )
     {
         Ni.push_back( Ni.at( i - 1 ) );
-        bool valid = true;
 
         for( const auto & rule : grammar.getRules( ) )
         {
-            for( const auto & symbol : rule.getRightSide( ) )
-            {
-                if( ! isInSet( symbol, Ni.at( i - 1 ) ) && ! isInSet( symbol, grammar.getTerminalSymbols( ) ) )
-                {
-                    valid = false;
-                    break;
-                }
-            }
-
-            if( valid )
+            if( all_of( rule.getRightSide( ).begin( ), rule.getRightSide( ).end( ), [ i, Ni, grammar ]( Symbol const& symbol ) -> bool {
+                return isInSet( symbol, Ni.at( i - 1 ) ) || isInSet( symbol, grammar.getTerminalSymbols( ) );
+            } ) )
                 Ni.at( i ).insert( rule.getLeftSide( ).front( ) );
         }
 
@@ -57,7 +49,7 @@ bool ContextFreeGrammarTransformations::isLanguageEmpty( const grammar::ContextF
 
 ContextFreeGrammar ContextFreeGrammarTransformations::removeUnreachableSymbols( const ContextFreeGrammar & grammar )
 {
-    // 1.
+    // 1
     deque<set<Symbol>> Vi;
     Vi.push_back( set<Symbol>( ) );
     Vi.at( 0 ).insert( grammar.getStartSymbol( ) );
@@ -73,10 +65,7 @@ ContextFreeGrammar ContextFreeGrammarTransformations::removeUnreachableSymbols(
         {
             if( isInSet( rule.getLeftSide( ).front( ), Vi.at( i - 1 ) ) )
             {
-                for( const auto & symbol : rule.getRightSide( ) )
-                {
-                    Vi.at( i ).insert( symbol );
-                }
+                Vi.at( i ).insert( rule.getRightSide( ).begin( ), rule.getRightSide( ).end( ) );
             }
         }
 
@@ -103,8 +92,9 @@ ContextFreeGrammar ContextFreeGrammarTransformations::removeUnreachableSymbols(
     // A->\alpha: if A \in N' and \alpha in V_i*, then A->\alpha in P
     for( const auto & rule : grammar.getRules( ) )
     {
-        if( isInSet( rule.getLeftSide( ).front( ) , ret.getNonTerminalSymbols( ) ) &&
-            all_of( rule.getRightSide( ).begin( ), rule.getRightSide( ).end( ), [ Vi, i ]( const Symbol & symb ){ return isInSet( symb, Vi.at( i ) ); } ) )
+        if( isInSet( rule.getLeftSide( ).front( ) , newNonTerminals ) && all_of( rule.getRightSide( ).begin( ), rule.getRightSide( ).end( ), [ Vi, i ]( Symbol const& symb ) -> bool {
+            return isInSet( symb, Vi.at( i ) );
+        } ) )
         {
             ret.addRule( rule );
         }
@@ -119,6 +109,7 @@ ContextFreeGrammar ContextFreeGrammarTransformations::removeUnproductiveSymbols(
 {
     // 1.
     set<Symbol> Nt = getProductiveNonTerminals( grammar );
+
     ContextFreeGrammar G1;
 
     for( const auto & symbol : Nt )
diff --git a/tests.aconversion.sh b/tests.aconversion.sh
index b8aab466f834f291c422bb826b79b3279e825cef..e32ddafe2f4a14803f6f0591c3ecc0d2c41c5fef 100755
--- a/tests.aconversion.sh
+++ b/tests.aconversion.sh
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 
-TESTCASE_ITERATIONS=20
+TESTCASE_ITERATIONS=200
 TESTCASE_TIMEOUT=5
 LOGFILE="log_tests.txt"