Added validation for the input