Fix infinite loop on empty lists
and simplify changing lane sizes