diff --git a/functions/pragma.c b/functions/pragma.c
new file mode 100644
index 0000000000000000000000000000000000000000..95085db619142e40d6bfcd2f300f0e3c1f4500ff
--- /dev/null
+++ b/functions/pragma.c
@@ -0,0 +1,90 @@
+#include "pragma.h"
+
+static void my_pragma_action(cpp_reader *ARG_UNUSED(dummy))
+{
+	printf("****** Pragam detected: ******\n");
+	enum cpp_ttype token;
+	tree x;
+	const char* elt;	
+	token = pragma_lex (&x);
+	bool close_paren_needed_p = false;
+	bool correct_pragma_names = true;	
+	bool is_in_array=false;
+	if (cfun){
+        	printf("!!Pragma placed inside function!!\n");
+       		correct_pragma_names = false;
+		return;
+    	}
+
+	
+	if (token == CPP_OPEN_PAREN){
+        	close_paren_needed_p = true;
+        	token = pragma_lex (&x);
+        }
+
+	if (token == CPP_NAME){
+		tree args = NULL_TREE;
+
+		do
+		{
+			if (TREE_STRING_LENGTH (x) > 0)
+            			args = tree_cons (NULL_TREE, x, args);
+			
+          		printf("Arg found : %s\n", IDENTIFIER_POINTER(x));	
+			is_in_array = false;
+			for (int ix = 0; pragma_func_names.iterate (ix, &elt); ix++){
+                                if(strcmp(elt,IDENTIFIER_POINTER(x))){
+					is_in_array = true;
+				}
+			}
+			if(is_in_array)
+				pragma_func_names_temp.safe_push(IDENTIFIER_POINTER(x));	
+			token = pragma_lex (&x);        					
+			//Cleans COMAS
+			while (token == CPP_COMMA){
+            			token = pragma_lex (&x);
+				
+			}
+
+
+        	}while (token == CPP_NAME);
+			
+		if(close_paren_needed_p){
+			if (token == CPP_CLOSE_PAREN){
+            			token = pragma_lex (&x);
+				
+			}
+			else{
+				printf("Missing closed parenthesis\n");
+				correct_pragma_names = false;
+				return;
+			}
+		}
+	
+	}
+	else{
+		printf("Invalid pragma - not starting with name or open parenthesis\n");
+		return;
+	}
+
+	if (token != CPP_EOF)
+        {
+          printf("Error : arg read but EOL not reached");
+	  correct_pragma_names = false;
+          return;
+        }
+
+	while(pragma_func_names_temp.length() != 0 && correct_pragma_names){
+		pragma_func_names.safe_push(pragma_func_names_temp.pop());
+	}
+
+	printf("\n\n");
+}
+
+
+static void register_my_pragma(void *event_data, void *data)
+{
+	c_register_pragma ("instrumente", "function", my_pragma_action);
+}
+
+
diff --git a/functions/pragma.h b/functions/pragma.h
new file mode 100644
index 0000000000000000000000000000000000000000..625efe58a30c224763a46c8f8fdb9e6b6a423c9d
--- /dev/null
+++ b/functions/pragma.h
@@ -0,0 +1,9 @@
+#ifndef __PRAGMADD__H
+#define __PRAGMADD__H
+
+vec<const char*> pragma_func_names;
+vec<const char*> pragma_func_names_temp;
+static void register_my_pragma(void *event_data, void *data);
+static void my_pragma_action(cpp_reader *ARG_UNUSED(dummy));
+
+#endif
diff --git a/plugin.cpp b/plugin.cpp
index ae48b078936e2978fd29a1e1b434d52b2b7a868b..566b6b359e4ed807cc5d12955b3a113b2a2310ed 100755
--- a/plugin.cpp
+++ b/plugin.cpp
@@ -22,6 +22,8 @@
 #include "./functions/graph.c"
 #include "./functions/MPI_functions.h"
 #include "./functions/MPI_functions.c"
+#include "./functions/pragma.h"
+#include "./functions/pragma.c"
 
 int plugin_is_GPL_compatible;
 
@@ -53,19 +55,6 @@ const pass_data cleanup_pass_data =
 };
 
 
-static void my_pragma_action(cpp_reader *ARG_UNUSED(dummy))
-{
-	printf("****** Pragma detected: ******\n");
-	printf("\n");
-}
-
-
-static void register_my_pragma(void *event_data, void *data)
-{
-	c_register_pragma ("instrumente", "function", my_pragma_action);
-}
-
-
 class split_count_pass : public gimple_opt_pass
 {
         public: