Final commit with graph working! legend and other stuff