added method to check for valid input