diff --git a/w2v-server.pl b/w2v-server.pl
index d72aff8..6cb8a7e 100755
--- a/w2v-server.pl
+++ b/w2v-server.pl
@@ -723,56 +723,56 @@
 	return res;
 }
 
-wordlist *getTargetWords(char *st1, int search_backw) {
+wordlist *getTargetWords(char *st1, int sbw) {
   wordlist *wl = malloc(sizeof(wordlist));
   char st[100][max_size], sep[100];
-	long a, b=0, c=0, cn=0;
+  long a, b=0, c=0, cn=0;
   int unmerged;
+  int search_backw = 0;
 
-	while (1) {
-		st[cn][b] = st1[c];
-    if(merge_words > 0)
+  while (1) {
+    st[cn][b] = st1[c];
+    if (merge_words > 0)
       st[cn+1][b] = st1[c];
-		b++;
-		c++;
-		st[cn][b] = 0;
-		if (st1[c] == 0) break;
-		if (st1[c] == ' ' || st1[c] == '-') {
+    b++;
+    c++;
+    st[cn][b] = 0;
+    if (st1[c] == 0) break;
+    if (st1[c] == ' ' || st1[c] == '-') {
       sep[cn++] = st1[c];
-      if(merge_words > 0)
+      if (merge_words > 0)
         sep[cn++] = st1[c];
-			b = 0;
-			c++;
-		}
-	}
-	cn++;
-  if(merge_words > 0)
+      b = 0;
+      c++;
+    }
+  }
+  cn++;
+  if (merge_words > 0)
     cn++;
-	for (a = 0; a < cn; a++) {
-		if(search_backw) {
-			for (b = words - 1; b >= 0; b--) if (!strcmp(&vocab[b * max_w], st[a])) break;
-		}  else {
-			for (b = 0; b < words; b++) 
-        if (!strcmp(&vocab[b * max_w], st[a])) {
-          if(merge_words > 0)
-            search_backw^=1;
-          break;
-        }
-		}
-		if (b == words) b = -1;
-		wl->wordi[a] = b;
-		fprintf(stderr, "Word: \"%s\"  Position in vocabulary: %lld\n", st[a], wl->wordi[a]);
-		if (b == -1) {
-			fprintf(stderr, "Out of dictionary word!\n");
-			cn--;
-			free(wl);
-			return NULL;
-		}
-	}
+  for (a = 0; a < cn; a++) {
+    if (search_backw) {
+      for (b = words - 1; b >= 0; b--) if (!strcmp(&vocab[b * max_w], st[a])) break;
+    } else {
+      if (merge_words > 0 && a % 2 == 1) {
+        for (b = merge_words; b < words; b++)
+          if (!strcmp(&vocab[b * max_w], st[a])) break;
+      } else {
+        for (b = 0; b < words; b++)
+          if (!strcmp(&vocab[b * max_w], st[a])) break;
+      }
+    }
+    if (b == words) b = -1;
+    wl->wordi[a] = b;
+    fprintf(stderr, "Word: \"%s\"  Position in vocabulary: %lld\n", st[a], wl->wordi[a]);
+    if (b == -1) {
+      fprintf(stderr, "Out of dictionary word!\n");
+      cn--;
+    }
+  }
   wl->length=cn;
   return(wl);
 }
- 
+
 void *_get_neighbours(void *arg) {
   knnpars *pars = arg;
 	char *st1 = pars->token;
