added trim feature