end of typechecker (I think)