mostly converted to plain ol' C still using bool typedefs