Separated script into multiple files for easier management. Added Makefile