Begun segregating functions from main.c, made header files.