added funciton for plotting