added plot function