refactored some code, added makefile