made better graph functionality