Add trimming to mutate function