Added C implementation.