basic plugin infrastructure (copyright @sparkica)