started reimplementing trim with test