As said in another comment, it would be better to refactor/reuse the same function/algorithm as for `availableWidths`.