add typechecker, but need more work