Implemented trimming functions