Added graph recording (save and load), tested it and fixed the bugs found.