Fix complicated cases and a typo in avoid_collisions
Use the skip stack when calculating the available width of the first line