improve smart trim example