Implemented trimming functions (proper commit)