refactored Graph