finished input validation for insert