add a method to validate the input