clean up and document flags in C interface