Changed the graph class to make it more efficient.
Small changes across the board.