Working implementation of C extension