add trim logic