Now checking if the input is valid.