implemented functions for c interface