updated for plotting