Cleanups in the internal API and in the API visible to extension developers.