Cleaned up and compiled with -Wall