Some additional validation/normalization is added for the language tag, and some cleanup has been done for logging.