finished main.c, requires testing