redesign spaghettiPlot code