added Makefile, separated functions from main, added header