Adding Makefile, code fixes