Cleaned up C interface