First version of typechecker