build "plugin loader" function