Trimming keys and values