fixed c99 warnings and improved the documentation