added plotting code