refactoring of typechecker. + new tests