created input validation for back end