updated main.c

I made it prettier and worked out some of the functions.