 		numerator = 0;
 		denominatorA = 0;
 		denominatorB = 0;
+
 		for (int j = 0; j < klimit; ++j) {
 			// TODO: verify correct index is being used here
 			charWeightIndex = (i * (dimensionality-1)) + j;
 			numerator += questionWeights[j] * characterWeights[charWeightIndex];
 			denominatorA += questionWeights[j] * questionWeights[j];
 			denominatorB += characterWeights[charWeightIndex] * characterWeights[charWeightIndex];
-			if (denominatorA && denominatorB) {
-				totalScore = numerator / (sqrt(denominatorA) * sqrt(denominatorB));
-			} else {
-				totalScore = 0;
-			}
+		}
+
+		if (denominatorA && denominatorB) {
+			totalScore = numerator / (sqrt(denominatorA) * sqrt(denominatorB));
+		} else {
+			totalScore = 0;
 		}
 		// printf("%d %c: %2.16f -- %f => %f\n", i, characters[i], characterWeights[charWeightIndex], totalScore, maxScore);
 

		}
	}
	return answer;
}

char nearestNeighbor(struct OCRkit *ocrKit, double *questionWeights)


#include "ocrKit.c"
#include <sys/time.h>

#define TRAINING_SET_SIZE = 78
#define DEBUG_PRINT_TIME 1

char nearestNeighborCPU(struct OCRkit *ocrKit, double *questionWeights)
