add better input validation