Many changes to support plugins.