copied code from example to plugin source