General functions

 
This section explains functions used in different steps of the balancing process.