Refactoring of the graph utilities and formula generators