Fix Makefile install. More progress on unit tests and refactoring