fix makefile
change %d to %zu
fixed bug with nestled loops, should now work
add comments
another cleanup to remove statics