Added a trim function