better type handling in checker
validate returns only invalid trees
logic simplification