Integrate pure C version