Improve Makefile and program structure