you probably can do the check directly on the extension, no need to iterate on the commands each time here, if I get it correctly.