Added Method to check if Input is valid