Trimming logic