Added Makefile and modularized the code