copied code from example to source plugin