Update to Plugin API and clean up old code.