Refactoring + change makefile