Factorized plugin factory code