changed plot code