main.c functions. Moved header files