working version with Makefile