added the typechecker (not yet complete)