Optimize and add graphs