separated the code into files; adds the graph