Added C implementation