Type system refactor