changed to c-style functions