Lots of type parsing fixes