moved from cpp to c totally