Making it all totally ANSI c99 compliant