Use more idiomatic C