Refactoring of how graph is generated and environment variables