I think comments with a little bit more detail on what each of these flags mean would be really helpful to someone first seeing this code.