improved typechecker.