replace trim method with a new one