 	cudaFree(dev_docScores);
 	/*
 	TODO: FREE QUERY
+	freeQuery();
 	*/
-}
-
-Query parseQuery(char* queryStr){
-	Query q;
-	char *tokens = strtok(queryStr, "#");
-	q.norm = atof(tokens);
-	char *termToWeight = strtok(NULL, "#");
-	q.size = 0;
-	int i;
-	for (i=0; i < strlen(termToWeight); i++)
-		if (termToWeight[i] == ';')
-			q.size++;
-	//printf("terms length: %d\n", q.size);
-	q.termsId = (int*) malloc(sizeof(int) * q.size);
-	q.weights = (float*) malloc(sizeof(float) * q.size);
-	char *tokenPtr1, *termStr, *weightStr;
-	tokens = strtok_r(termToWeight, ";", &tokenPtr1);
-	int termPos = 0;
-	while (tokens != NULL) {
-		char *tokenPtr2, *intPtr;
-		termStr = strtok_r(tokens, ":", &tokenPtr2);
-		weightStr = strtok_r(NULL, ":", &tokenPtr2);
-		q.weights[termPos] = atof(weightStr);
-		q.termsId[termPos] = strtol(termStr, &intPtr, 10);
-		tokens = strtok_r(NULL, ";", &tokenPtr1);
-		termPos++;
-	}
-	return q;
+
 }
 
 void handleKernelError(){

#define POSTINGS_FILE4 "resources/mini_seq_posting.txt"
#define DOCUMENTS_NORM "resources/documents_norm.txt"

typedef struct Query {
   int size;
   float *weights;
   int *termsId;
	 float norm;
 } Query;

Posting* postingsFromSeqFile(FILE *postingsFile, int totalTerms);
float* docsNormFromSeqFile(FILE *docsNormFile, int totalDocs);
void index_collection();
void resolveQuery(char *query);
Query parseQuery(char* queryStr);
void handleKernelError();
cudaError_t checkCuda(cudaError_t result);
// to use only during developing, delete on production
Posting* LoadDummyPostings(int size);
void displayPosting(Posting *postings, int size);



// global variables that are allocated in device during indexing

	cudaEventCreate(&resolveQueryStop);
  int i;
	Query q = parseQuery(queryStr);
	/*
  int previousCharIsSpace = 0;
  int spacesCounter = 0;
