move typdefs and function declarations into header file