Heavily commented and updated the graph api.