now check for valid input