Fix #1 API and C code improvements