move trimNested() down later in the steps

cc @sh1mmer