Checks for valid user input