added trim functions