Added BSD3 license, updated Makefile, minor fixes to code