Move type definitions to a header file. Also, redo the last commit.