Trim function.