added main.c with functions