optimizing the plot