Improved the types system implementation