Improved graph reading code.