better input validator