Improving validity checks