added graphing code