Clean up header includes per convention and resolve all warnings.

main.c is still a mess, but that's for later.