soapy: filling in the c implementation