added graphing function