Extensive reworking of feature detect and plugin