refactored graphing engine