trim and update