Finished refactoring graphengine