Separate functions from main.c by adding functions.c and functions.h. Update Makefile.