As noted by Mitch, this is simpler and what we do in other plug-ins. (cherry picked from commit ef3c13c6)