Refactored management of number of edges