Add trim and tests