Makefile and refactoring