Finished implementing the typechecker