Moved all functions into one file and modified Makefile accordingly