Fixed broken Makefile.
Fixed bug in code.