Replaced inline C with C extension