Trimming based on flag.