tidied up get_local_plugin method