added plot save code