done with Cfunctions and alloc