fix makefile and simplification of code
removing tmp file