Added more type support and a bunch of other changes.