makefile and other improvements