Improvements to type system