cleanup code
correct prototypes
restructure header files