Added CFLAGS and fix minor C99 standards violations. Builds and seems to work...