Small change in trimming function