clean c impl