Removed debug trimming function