Improve and generalize handling of whether comments are allowed.