Added plotting function, not finished yet