diff --git a/derekovecs-server.c b/derekovecs-server.c
index 3791ade..5b8915f 100644
--- a/derekovecs-server.c
+++ b/derekovecs-server.c
@@ -129,7 +129,7 @@
 int init_net(char *file_name, char *net_name, int latin, int do_open_cdb) {
   FILE *f, *binvecs, *binwords;
   int binwords_fd, binvecs_fd, net_fd, i;
-  long long a, b, c, d, cn;
+  long long a, b;
   float len;
   double val;
 
@@ -264,10 +264,8 @@
 }
 
 long mergeVectors(char *file_name) {
-  FILE *f, *binvecs, *binwords;
-  int binwords_fd, binvecs_fd, net_fd, i;
-  long long a, b, c, d, cn;
-  float len;
+  FILE *f;
+  int binwords_fd, binvecs_fd;
   float *merge_vecs;
   char *merge_vocab;
   /*  long long merge_words, merge_size; */
@@ -284,7 +282,7 @@
   f = fopen(file_name, "rb");
   if (f == NULL) {
     printf("Input file %s not found\n", file_name);
-    exit - 1;
+    exit(-1);
   }
   fscanf(f, "%lld", &merge_words);
   fscanf(f, "%lld", &merge_size);
@@ -329,9 +327,9 @@
   garbage = malloc(words);
   memset(garbage, 0, words);
   for (i = 0; i < words; i++) {
-    w = vocab + i * max_w;
+    w = (unsigned char *) vocab + i * max_w;
     previous = 0;
-    if (strncmp("quot", w, 4) == 0) {
+    if (strncmp("quot", (const char *)w, 4) == 0) {
       garbage[i] = 1;
       //      printf("Gargabe: %s\n", vocab + i * max_w);
     } else {
@@ -353,20 +351,20 @@
 
 knn *simpleGetCollocators(int word, int number, long cutoff, int *result) {
   knnpars *pars = calloc(sizeof(knnpars), 1);
-  float *target_sums;
-  float *window_sums = malloc(sizeof(float) * (window + 1) * 2);
+  float *target_sums = NULL;
+  float *my_window_sums = malloc(sizeof(float) * (window + 1) * 2);
   pars->cutoff = (cutoff ? cutoff : 300000);
-  long a = posix_memalign((void **)&target_sums, 128, pars->cutoff * sizeof(float));
+  long a;
   for (a = 0; a < cutoff; a++)
     target_sums[a] = 0;
   pars->target_sums = target_sums;
-  pars->window_sums = window_sums;
+  pars->window_sums = my_window_sums;
   pars->N = (number ? number : 20);
   pars->from = 0;
   pars->upto = window * 2 - 1;
   knn *syn_nbs = NULL;  // = (knn*) getCollocators(pars);
   free(pars);
-  free(window_sums);
+  free(my_window_sums);
   free(target_sums);
   return syn_nbs;
 }
@@ -378,7 +376,7 @@
   int cc = pars->wl->wordi[0];
   knn *nbs = NULL;
   long window_layer_size = size * window * 2;
-  long a, b, c, d, e, window_offset, target, max_target = 0, maxmax_target;
+  long a, b, c, d, window_offset, target, max_target = 0, maxmax_target;
   float f, max_f, maxmax_f;
   float *target_sums = NULL, worstbest, wpos_sum;
   collocator *best;
@@ -444,7 +442,7 @@
             worstbest = best[N - 1].activation;
         }
       }
-      printf("%d %.2f\n", max_target, max_f);
+      printf("%ld %.2f\n", max_target, max_f);
       printf("%s (%.2f) ", &vocab[max_target * max_w], max_f);
       if (max_f > maxmax_f) {
         maxmax_f = max_f;
@@ -464,7 +462,7 @@
   free(target_sums);
   for (b = 0; b < N && best[b].wordi >= 0; b++)
     ;
-  ;  // THIS LOOP IS NEEDED (b...)
+     // THIS LOOP IS NEEDED (b...)
      //		printf("%d: best syn: %s %.2f %.5f\n", b, &vocab[best[b].wordi*max_w], best[b].activation, best[b].probability);
      //	printf("\n");
   nbs = malloc(sizeof(knn));
@@ -483,12 +481,12 @@
   }
 
   if (hidden >= size) {
-    fprintf(stderr, "hidden: %d - assert: hidden < %d failed.\n", hidden, size);
+    fprintf(stderr, "hidden: %d - assert: hidden < %lld failed.\n", hidden, size);
     exit(-1);
   }
 
   if (target >= words) {
-    fprintf(stderr, "target: %ld - assert: target < %ld failed.\n", target, words);
+    fprintf(stderr, "target: %ld - assert: target < %lld failed.\n", target, words);
     exit(-1);
   }
 
@@ -536,7 +534,7 @@
   }
   buffer[strlen(buffer) - 1] = ']';
   strcat(buffer, "\n");
-  printf(buffer);
+  printf("%s", buffer);
   return (strdup(buffer));
 }
 
@@ -547,9 +545,8 @@
 
 wordlist *getTargetWords(char *st1, int search_backw) {
   wordlist *wl = malloc(sizeof(wordlist));
-  char st[100][max_size], sep[100];
+  char st[100][max_size];
   long a, b = 0, c = 0, cn = 0;
-  int unmerged;
 
   while (1) {
     st[cn][b] = st1[c];
@@ -558,7 +555,6 @@
     st[cn][b] = 0;
     if (st1[c] == 0) break;
     if (st1[c] == ' ' /*|| st1[c] == '-'*/) {
-      sep[cn++] = st1[c];
       b = 0;
       c++;
     }
@@ -601,10 +597,8 @@
 
 char *getBiggestMergedDifferences() {
   static char *result = NULL;
-  float dist, len, vec[max_size];
-  long long a, b, c, d, cn, *bi;
-  char ch;
-  knn *nbs = NULL;
+  float dist;
+  long long a, c;
   int N = 1000;
 
   if (merged_end == 0)
@@ -624,7 +618,6 @@
 
   for (c = 0; c < 500000; c++) {
     if (garbage && garbage[c]) continue;
-    a = 0;
     dist = 0;
     for (a = 0; a < size; a++) dist += M[a + c * size] * M[a + (c + merged_end) * size];
     if (dist < worstbest) {
@@ -645,7 +638,7 @@
   *p++ = '[';
   *p = 0;
   for (a = 0; a < N; a++) {
-    p += sprintf(p, "{\"rank\":%d,\"word\":\"%s\",\"dist\":%.3f},", a, &vocab[best[a].wordi * max_w], 1 - best[a].activation);
+    p += sprintf(p, "{\"rank\":%lld,\"word\":\"%s\",\"dist\":%.3f},", a, &vocab[best[a].wordi * max_w], 1 - best[a].activation);
   }
   *--p = ']';
   return (result);
@@ -675,14 +668,12 @@
 
 void *_get_neighbours(void *arg) {
   knnpars *pars = arg;
-  char *st1 = pars->token;
   int N = pars->N;
   long from = pars->from;
   unsigned long upto = pars->upto;
-  char file_name[max_size], st[100][max_size], *sep;
+  char *sep;
   float dist, len, vec[max_size];
-  long long a, b, c, d, cn, *bi;
-  char ch;
+  long long a, b, c, cn, *bi;
   knn *nbs = NULL;
   wordlist *wl = pars->wl;
 
@@ -696,9 +687,7 @@
   cn = wl->length;
   sep = wl->sep;
   b = bi[0];
-  c = 0;
   if (b == -1) {
-    N = 0;
     goto end;
   }
   for (a = 0; a < size; a++) vec[a] = 0;
@@ -753,9 +742,8 @@
 
 char *getPosWiseW2VCollocatorsAsTsv(char *word, long maxPerPos, long cutoff, float threshold) {
   HV *result = newHV();
-  float *target_sums = NULL, vec[max_size];
-  long long old_words;
-  long a, b, c, d;
+  float *target_sums = NULL;
+  long a, b;
   knn *para_nbs[MAX_THREADS];
   knn *syn_nbs[MAX_THREADS];
   knnpars pars[MAX_THREADS];
@@ -808,8 +796,7 @@
 
 SV *get_neighbours(char *st1, int N, int sort_by, int search_backw, long cutoff, int dedupe, int no_similar_profiles) {
   HV *result = newHV();
-  float *target_sums = NULL, vec[max_size];
-  long long old_words;
+  float *target_sums = NULL;
   long a, b, c, d, slice;
   knn *para_nbs[MAX_THREADS];
   knn *syn_nbs[MAX_THREADS];
@@ -832,7 +819,6 @@
   if (wl == NULL || wl->length < 1)
     goto end;
 
-  old_words = cutoff;
   slice = cutoff / para_threads;
 
   a = posix_memalign((void **)&target_sums, 128, cutoff * sizeof(float));
@@ -881,7 +867,7 @@
   qsort(best, N * para_threads, sizeof(collocator), cmp_activation);
 
   long long chosen[MAX_NEIGHBOURS];
-  printf("N: %ld\n", N);
+  printf("N: %d\n", N);
 
   AV *array = newAV();
   int i, j;
@@ -953,7 +939,7 @@
     for (a = 0; a <= syn_threads; a++) {
       if (a == window) continue;
       total_activation += window_sums[a];
-      printf("window pos: %d, sum: %f\n", a, window_sums[a]);
+      printf("window pos: %ld, sum: %f\n", a, window_sums[a]);
     }
     printf("syn threads joint\n");
     fflush(stdout);
@@ -970,7 +956,7 @@
     }
 
     float best_window_sum[MAX_NEIGHBOURS];
-    int found_index = 0, i = 0, j, w;
+    int found_index = 0, i = 0, w;
     for (a = 0; a < syn_threads; a++) {
       for (b = 0; b < syn_nbs[a]->length; b++) {
         for (i = 0; i < found_index; i++)
@@ -1143,7 +1129,6 @@
     hv_store(result, "syntagmatic", strlen("syntagmatic"), newRV_noinc((SV *)array), 0);
   }
 end:
-  //  words = old_words; // why was this here?
   free(best);
   return newRV_noinc((SV *)result);
 }
