C code adapted to include annuli
C function edits