Added a cooler and more generalizable graphing function