added trim function