Changed C function to take two arguments