Major changes to plotting code.