fixed mistakes, added types.h for type definitions