Cleaned up the type file and added a bunch of comments