Cleaned up main.c a bit